gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Nov 21 12:48:21 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/cdb764fe (commit)
	 via  https://github.com/Gnucash/gnucash/commit/169677a8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d44f6bc9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/961cb5a8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d648b29d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9444c1e3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/060e16b6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/75fb4e7a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/949f2db4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cd9c3807 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ce900d1d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d66469fe (commit)
	 via  https://github.com/Gnucash/gnucash/commit/18dcbeef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/aeb80a23 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0dfb921e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/de4414b2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/954ce1ab (commit)
	 via  https://github.com/Gnucash/gnucash/commit/61316648 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1895ae28 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f888eb88 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/179d022d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1f4a2e36 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/54b492ee (commit)
	 via  https://github.com/Gnucash/gnucash/commit/45585219 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9c3247d5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9253b502 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/45bab936 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f9d5436a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6c01e540 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f412795e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3b0bcf75 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ed3de42c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6228881d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/98d8696b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7a2c1492 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/45116183 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c5fb0d6d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/55002113 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0c443836 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2a938425 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a278bcc0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0ba9b768 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/70ad2c3b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bb16e07d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9f76441d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c19f851c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/90bbeac0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/97c3483e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c71bfe8d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/78cd5416 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/64cfab05 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e26c55e6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f2834377 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0b3da701 (commit)
	from  https://github.com/Gnucash/gnucash/commit/4f971636 (commit)



commit cdb764fec525642bbe85dd5a0a49ec967c55f089
Merge: 169677a ed3de42
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 21 18:30:09 2017 +0100

    Merge branch 'gtk3-update8' of https://github.com/Bob-IT/gnucash into unstable
    
    More register layout tweaks


commit 169677a8d753ba26a447d22d2b2ec565bfe4798b
Merge: d44f6bc 179d022
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 21 17:04:27 2017 +0100

    Merge branch 'gtk3-update9' of https://github.com/Bob-IT/gnucash into unstable
    
    This branch has several improvements in the dense calendar code. The most
    important of these is to fix a crash on Windows.


commit d44f6bc9d533c1159886b52affcbd43a34b1ded4
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 19 17:28:53 2017 -0800

    Fix missing/misspelled files for distribution.
    
    Mostly errors from 6c01e54.

diff --git a/gnucash/gnome-utils/test/CMakeLists.txt b/gnucash/gnome-utils/test/CMakeLists.txt
index eab5563..f2b85bd 100644
--- a/gnucash/gnome-utils/test/CMakeLists.txt
+++ b/gnucash/gnome-utils/test/CMakeLists.txt
@@ -45,4 +45,4 @@ GNC_ADD_SCHEME_TARGETS(scm-test-load-gnome-utils-module
 GNC_ADD_SCHEME_TESTS(test-load-gnome-utils-module.scm)
 
 
-SET_DIST_LIST(test_gnome_utils_DIST CMakeLists.txt Makefile.am test-gnc-recurrence.c test-link-module.c test-load-report-gnome-module.scm)
+SET_DIST_LIST(test_gnome_utils_DIST CMakeLists.txt Makefile.am test-gnc-recurrence.c test-link-module.c test-load-gnome-utils-module.scm)
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
index e76d828..5d35d15 100644
--- a/gnucash/report/report-system/test/CMakeLists.txt
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -37,9 +37,8 @@ GNC_ADD_SCHEME_TARGETS(scm-test-report-system-2
 SET_DIST_LIST(test_report_system_DIST
   CMakeLists.txt
   Makefile.am
-  test-collectors.scm
+  ${scm_test_report_system_SOURCES}
   test-extras.scm
   test-link-module.c
-  test-report-utilities.scm
-  test-list-extras.scm
+  test-test-extras.scm
 )
diff --git a/gnucash/report/standard-reports/test/CMakeLists.txt b/gnucash/report/standard-reports/test/CMakeLists.txt
index 0692020..00d20cb 100644
--- a/gnucash/report/standard-reports/test/CMakeLists.txt
+++ b/gnucash/report/standard-reports/test/CMakeLists.txt
@@ -28,6 +28,5 @@ GNC_ADD_SCHEME_TARGETS(scm-test-standard-reports
   FALSE
 )
 
-SET_DIST_LIST(test_standard_reports_DIST CMakeLists.txt Makefile.am ${scm_test_standard_reports_SOURCES}
-        test-cash-flow.scm test-cashflow-barchart.scm test-standard-category-report.scm test-standard-net-barchart.scm
-        test-standard-net-linechart.scm)
+SET_DIST_LIST(test_standard_reports_DIST CMakeLists.txt Makefile.am
+  ${scm_test_standard_reports_SOURCES} ${scm_test_report_SUPPORT})
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index b99b936..faa1e68 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -56,5 +56,6 @@ SET_DIST_LIST(test_app_utils_DIST
   test-print-queries.cpp
   test-scm-query-string.cpp
   test-sx.cpp
+  test-load-app-utils-module.scm
   ${test_app_utils_SOURCES}
 )

commit 961cb5a829bb325525652429886aeed71e6d4483
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 19 17:28:41 2017 -0800

    Bug 790550 - FTBFS: missing __init__.py

diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index a5988ae..5c8f129 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -1,6 +1,8 @@
 ADD_SUBDIRECTORY(example_scripts)
 ADD_SUBDIRECTORY(tests)
 
+SET(PYEXEC_FILES  __init__.py function_class.py gnucash_business.py gnucash_core.py)
+
 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
@@ -64,8 +66,6 @@ IF(WITH_PYTHON)
     ${PYTHON_INCLUDE_DIRS}
   )
 
-  SET(PYEXEC_FILES  __init__.py function_class.py gnucash_business.py gnucash_core.py)
-
   ADD_LIBRARY(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
   TARGET_INCLUDE_DIRECTORIES(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
 
@@ -102,10 +102,12 @@ IF(WITH_PYTHON)
 ENDIF()
 
 SET(python_bindings_DATA ${PYEXEC_FILES}
-        gnucash_core.i
-        sqlite3test.c
-        timespec.i)
+  gnucash_core.i
+  sqlite3test.c
+  timespec.i)
 
-SET_LOCAL_DIST(python_bindings_DIST_local CMakeLists.txt Makefile.am ${python_bindings_DATA})
+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)
+SET(python_bindings_DIST ${python_bindings_DIST_local}
+  ${test_python_bindings_DIST} ${example_scripts_DIST} PARENT_SCOPE)

commit d648b29d0d99f59fb833ec1ff9187a889bfe4c1d
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 19 17:20:26 2017 -0800

    Fix distribution paths for resource files.
    
    glib-compile-resources lists the resource files as absolute paths,
    but SET_LOCAL_DIST expects relative paths; the result was that the
    tarball code was looking for ${CMAKE_SOURCE_DIR}/${CMAKE_CURRENT_SOURCE_DIR}/foo.
    This change strips off ${CMAKE_CURRENT_SOURCE_DIR} from the filenames
    before passing them to SET_LOCAL_DIST.

diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index 205bbfd..69fc47e 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -237,9 +237,16 @@ IF (WIN32)
   INSTALL(PROGRAMS ${CMD_FILE} DESTINATION bin)
 ENDIF(WIN32)
 
+# The GResource Files are absolute paths but SET_LOCAL_DIST requires
+# relative paths.
+FOREACH(gres_file ${gresource_files})
+  FILE(RELATIVE_PATH rel_file ${CMAKE_CURRENT_SOURCE_DIR} ${gres_file})
+  LIST(REMOVE_ITEM gresource_files ${gres_file})
+  LIST(APPEND gresource_files ${rel_file})
+ENDFOREACH()
 
 SET_LOCAL_DIST(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
-               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in gnucash-gresourses.xml ${gresource_files}
+               gnucash-bin.c gnucash.rc.in gnucash-valgrind.in gnucash-gresources.xml ${gresource_files}
                Makefile.am ${gnucash_EXTRA_DIST})
 
 SET(gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST}

commit 9444c1e300e869aeea763a2db4f164560d067232
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 19 14:05:09 2017 -0800

    Fix bad string construction in adjust_sql_options.

diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index 4e6077e..bd50be6 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -582,7 +582,7 @@ adjust_sql_options (dbi_conn connection)
 
     std::string adjusted_str{adjust_sql_options_string(str)};
     PINFO("Setting sql_mode to %s", adjusted_str.c_str());
-    std::string set_str{"SET sql_mode=" + std::move(adjusted_str)};
+    std::string set_str{"SET sql_mode='" + std::move(adjusted_str) + "'"};
     dbi_result set_result = dbi_conn_query(connection,
                                            set_str.c_str());
     if (set_result)

commit 060e16b671cf1dbce28c5d29b21a2c55f55670bf
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Nov 18 20:41:10 2017 +0100

    Fix a few travis failures (potentially uninitialized use)

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 62b8ca0..b78d2c8 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -452,13 +452,16 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
             else
             {
                 GncOwner lotowner;
+                gncOwnerInitUndefined(&lotowner, NULL);
                 if (!gncOwnerGetOwnerFromLot(lot_info->lot, &lotowner))
                 {
                     const GncOwner *owner;
                     const GncInvoice *invoice = gncInvoiceGetInvoiceFromLot(lot_info->lot);
                     if (invoice)
+                    {
                         owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
-                    gncOwnerCopy (owner, &lotowner);
+                        gncOwnerCopy (owner, &lotowner);
+                    }
                 }
                 if (gncOwnerEqual(&pw->owner, &lotowner))
                     list = g_list_prepend (list, lot_info->lot);
@@ -1504,7 +1507,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
     {
         Split *selected_split = NULL;
         GList *node;
-        GtkWidget *first_rb;
+        GtkWidget *first_rb = NULL;
         int answer = GTK_BUTTONS_OK;
         const char *message = _("While this transaction has multiple splits that can be considered\nas 'the payment split', gnucash only knows how to handle one.\n"
                                 "Please select one, the others will be ignored.\n\n");

commit 75fb4e7a0ceda8ac5ba21866fc13cf39f79cc11c
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Nov 18 18:53:55 2017 +0100

    Bug 736765 - Assign as payment... should re-populate the payment represented by the selected transaction if any
    
    The main topic of this bug was already fixed in earlier commits. This commit
    handles the minor improvements also mentioned here:
    - don't show the menu option for invoice/bill transactions as that doesn't make sense
    - don't show the pre-payment line if the selected transaction was one, in this case only set the amount
    - allow users to edit lot link transactions via this mechanism as well (which essentially are payments without an explicit payment split)

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index d45a946..62b8ca0 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -541,7 +541,10 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
                                     GNC_HOW_RND_ROUND_HALF_UP);
         }
 
-        if (gnc_numeric_positive_p (value))
+        if (gnc_numeric_zero_p (value))
+        /* If the lot's balance is 0 after the above compensation, skip this lot */
+            continue;
+        else if (gnc_numeric_positive_p (value))
             debit = value;
         else
             credit = gnc_numeric_neg (value);
@@ -1473,16 +1476,23 @@ static char *gen_split_desc (Transaction *txn, Split *split)
 
 static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
 {
+    /* We require the txn to have one split in an Asset account.
+     * The only exception would be a lot link transaction
+     */
     GList *payment_splits = xaccTransGetPaymentAcctSplitList (txn);
     if (!payment_splits)
     {
+        GtkWidget *dialog;
+
+        if (xaccTransGetTxnType(txn) == TXN_TYPE_LINK)
+            return NULL;
 
-        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
-                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                    GTK_MESSAGE_INFO,
-                                                    GTK_BUTTONS_CLOSE,
-                                                    "%s",
-                                                    _("The selected transaction doesn't have splits that can be assigned as a payment"));
+        dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         GTK_MESSAGE_INFO,
+                                         GTK_BUTTONS_CLOSE,
+                                         "%s",
+                                         _("The selected transaction doesn't have splits that can be assigned as a payment"));
         gtk_dialog_run (GTK_DIALOG(dialog));
         gtk_widget_destroy (dialog);
         g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
@@ -1647,12 +1657,14 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
     if (!txn)
         return NULL;
 
-    // We require the txn to have one split in an Asset account.
     if (!xaccTransGetSplitList(txn))
         return NULL;
 
+    /* We require the txn to have one split in an Asset account.
+     * The only exception would be a lot link transaction
+     */
     payment_split = select_payment_split (parent, txn);
-    if (!payment_split)
+    if (!payment_split && (xaccTransGetTxnType(txn) != TXN_TYPE_LINK))
         return NULL;
 
     /* Get all APAR related lots. Watch out: there might be none */
@@ -1678,6 +1690,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         gnc_ui_payment_window_set_date(pw, &txn_date);
     }
     gnc_ui_payment_window_set_amount(pw, xaccSplitGetValue(payment_split));
-    gnc_ui_payment_window_set_xferaccount(pw, xaccSplitGetAccount(payment_split));
+    if (payment_split)
+        gnc_ui_payment_window_set_xferaccount(pw, xaccSplitGetAccount(payment_split));
     return pw;
 }
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 5b1efca..366574b 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -904,7 +904,7 @@ gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
 {
     GncMainWindow  *window;
     GtkActionGroup *action_group;
-    gboolean is_txn_register, is_bus_txn = FALSE;
+    gboolean is_txn_register, is_bus_txn = FALSE, is_bus_doc = FALSE;
 
     // We continue only if the current page is a plugin page
     if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
@@ -921,16 +921,17 @@ gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
         Transaction *trans = gnc_plugin_page_register_get_current_txn (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
         if (xaccTransCountSplits(trans) > 0)
             is_bus_txn = (xaccTransGetFirstAPARAcctSplit(trans, TRUE) != NULL);
+        is_bus_doc = (xaccTransGetTxnType (trans) == TXN_TYPE_INVOICE);
     }
     // 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 && !is_bus_txn);
+                               "sensitive", is_txn_register && !is_bus_txn && !is_bus_doc);
     gnc_plugin_update_actions (action_group, register_txn_actions,
-                               "visible", is_txn_register && !is_bus_txn);
+                               "visible", is_txn_register && !is_bus_txn && !is_bus_doc);
     gnc_plugin_update_actions (action_group, register_bus_txn_actions,
-                               "sensitive", is_txn_register && is_bus_txn);
+                               "sensitive", is_txn_register && is_bus_txn && !is_bus_doc);
     gnc_plugin_update_actions (action_group, register_bus_txn_actions,
-                               "visible", is_txn_register && is_bus_txn);
+                               "visible", is_txn_register && is_bus_txn && !is_bus_doc);
 }
 
 

commit 949f2db4732283f6f8ac2e1b6cc1a960a3f8f311
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed Nov 15 14:30:25 2017 +0100

    Bug 778692 - Assign as payment should work for employee expense vouchers
    
    The way this is implemented is as follows
    - if gnucash can deduce a partner from the transaction that partner will be proposed
      this works for all transactions that are part of a business transaction already
      and will correctly detect pre-existing customer, vendor and employee payments
    - if no partner can be deduced gnucash will assume the transaction to be a vendor
      or customer payment based on the sign
    - in all cases the user can change the partner type in the payment window that's presented
      to any of customer, vendor or employee to correct gnucash' suggestion.

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index efdc193..d45a946 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -54,8 +54,13 @@
 #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"
+#define DIALOG_PAYMENT_CM_CLASS "payment-dialog"
+
+typedef enum
+{
+    COL_OWNER_TYPE_NAME ,
+    COL_OWNER_TYPE_NUM ,
+} OwnerTypeCols;
 
 typedef struct
 {
@@ -65,10 +70,11 @@ typedef struct
 
 typedef struct
 {
+    GncOwner      owner;
     Transaction * txn;
     Account     * post_acct;
     GList       * lots;
-} PreExistTxnInfo;
+} InitialPaymentInfo;
 
 struct _payment_window
 {
@@ -79,9 +85,13 @@ struct _payment_window
     GtkWidget   * num_entry;
     GtkWidget   * memo_entry;
     GtkWidget   * post_combo;
+    GtkWidget   * owner_box;
+    GtkWidget   * owner_type_combo;
     GtkWidget   * owner_choice;
     GtkWidget   * amount_debit_edit;
     GtkWidget   * amount_credit_edit;
+    GtkWidget   * amount_payment_box;
+    GtkWidget   * amount_refund_box;
     GtkWidget   * date_edit;
     GtkWidget   * acct_tree;
     GtkWidget   * docs_list_tree_view;
@@ -91,13 +101,14 @@ struct _payment_window
     gint          component_id;
     QofBook     * book;
     GncOwner      owner;
+    GncOwnerType  owner_type;
     Account     * post_acct;
     Account     * xfer_acct;
     gnc_numeric   amount_tot;
     GList       * acct_types;
     GList       * acct_commodities;
 
-    PreExistTxnInfo *tx_info;
+    InitialPaymentInfo *tx_info;
     gboolean      print_check_state;
 };
 
@@ -178,6 +189,7 @@ static gboolean gnc_payment_dialog_has_pre_existing_txn(const PaymentWindow* pw)
 {
     return pw->tx_info->txn != NULL;
 }
+int  gnc_payment_dialog_owner_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data);
 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);
@@ -560,18 +572,16 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
 }
 
 static void
+gnc_payment_dialog_post_to_changed (PaymentWindow *pw)
+{
+    gnc_payment_window_fill_docs_list (pw);
+}
+
+static void
 gnc_payment_dialog_owner_changed (PaymentWindow *pw)
 {
-    Account *last_acct = NULL;
-    GncGUID *guid = NULL;
     GncOwner *owner = &pw->owner;
 
-    /* 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)
     {
@@ -588,33 +598,89 @@ gnc_payment_dialog_owner_changed (PaymentWindow *pw)
     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 (gncOwnerEqual(&pw->owner, &pw->tx_info->owner) && pw->tx_info->post_acct)
+    {
+        pw->post_acct = pw->tx_info->post_acct;
+        gnc_ui_payment_window_set_postaccount (pw, pw->post_acct);
+    }
+    gnc_payment_dialog_post_to_changed (pw);
 
     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))
+    if (!gnc_payment_dialog_has_pre_existing_txn(pw))
     {
-        gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
+        GncGUID *guid = NULL;
+        Account *last_acct = NULL;
+
+        if (gncOwnerIsValid(owner))
+            qof_instance_get (qofOwnerGetOwner (owner),
+                            "payment-last-account", &guid,
+                            NULL);
+        last_acct = xaccAccountLookup(guid, pw->book);
+        if (last_acct)
+            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_dialog_owner_type_changed (PaymentWindow *pw)
 {
-    gnc_payment_window_fill_docs_list (pw);
+    GtkWidget *debit_box, *credit_box;
+
+    /* 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 (pw->owner_type == GNC_OWNER_CUSTOMER)
+    {
+        debit_box = pw->amount_refund_box;
+        credit_box = pw->amount_payment_box;
+    }
+    else
+    {
+        debit_box = pw->amount_payment_box;
+        credit_box = pw->amount_refund_box;
+    }
+
+    g_object_ref (G_OBJECT (pw->amount_debit_edit));
+    g_object_ref (G_OBJECT (pw->amount_credit_edit));
+
+    if (gtk_widget_is_ancestor(pw->amount_debit_edit, credit_box))
+        gtk_container_remove (GTK_CONTAINER (credit_box), pw->amount_debit_edit);
+    if (gtk_widget_is_ancestor(pw->amount_credit_edit, debit_box))
+        gtk_container_remove (GTK_CONTAINER (debit_box), pw->amount_credit_edit);
+
+    if (!gtk_widget_is_ancestor(pw->amount_debit_edit, debit_box))
+        gtk_box_pack_start (GTK_BOX (debit_box), pw->amount_debit_edit, TRUE, TRUE, 0);
+    if (!gtk_widget_is_ancestor(pw->amount_credit_edit, credit_box))
+        gtk_box_pack_start (GTK_BOX (credit_box), pw->amount_credit_edit, TRUE, TRUE, 0);
+
+    g_object_unref (G_OBJECT (pw->amount_debit_edit));
+    g_object_unref (G_OBJECT (pw->amount_credit_edit));
+
+    /* Redo the owner_choice widget */
+    if (pw->owner_choice)
+        gtk_widget_destroy(pw->owner_choice);
+    pw->owner_choice = gnc_owner_select_create (NULL, pw->owner_box, pw->book, &pw->owner);
+    gtk_widget_show (pw->owner_choice);
+    gnc_payment_dialog_owner_changed (pw);
+
+    g_signal_connect (G_OBJECT (pw->owner_choice), "changed",
+                      G_CALLBACK (gnc_payment_dialog_owner_changed_cb), pw);
 }
 
 static void
@@ -641,7 +707,43 @@ gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
     gnc_payment_dialog_owner_changed(pw);
 }
 
-static int
+
+static void
+gnc_payment_set_owner_type (PaymentWindow *pw, GncOwnerType owner_type)
+{
+    gboolean valid;
+    GtkTreeModel *store;
+    GtkTreeIter iter;
+
+    switch (owner_type)
+    {
+        case GNC_OWNER_CUSTOMER:
+        case GNC_OWNER_EMPLOYEE:
+        case GNC_OWNER_VENDOR:
+            pw->owner_type = owner_type;
+            break;
+        default:
+            pw->owner_type = GNC_OWNER_CUSTOMER;
+    }
+
+    store = gtk_combo_box_get_model (GTK_COMBO_BOX(pw->owner_type_combo));
+    valid = gtk_tree_model_get_iter_first (store, &iter);
+    while (valid)
+    {
+        GncOwnerType owner_type;
+        gtk_tree_model_get (store, &iter, COL_OWNER_TYPE_NUM, &owner_type, -1);
+        if (owner_type == pw->owner_type)
+        {
+            gtk_combo_box_set_active_iter (GTK_COMBO_BOX(pw->owner_type_combo), &iter);
+            break;
+        }
+        valid = gtk_tree_model_iter_next (store, &iter);
+    }
+
+    gnc_payment_dialog_owner_type_changed (pw);
+}
+
+int
 gnc_payment_dialog_owner_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
@@ -665,6 +767,55 @@ gnc_payment_dialog_owner_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer d
     return FALSE;
 }
 
+static int
+gnc_payment_dialog_owner_type_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
+{
+    PaymentWindow *pw = data;
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    GncOwnerType owner_type;
+
+    if (!pw) return FALSE;
+
+    gtk_combo_box_get_active_iter (GTK_COMBO_BOX(pw->owner_type_combo), &iter);
+    model = gtk_combo_box_get_model (GTK_COMBO_BOX(pw->owner_type_combo));
+    gtk_tree_model_get (model, &iter, COL_OWNER_TYPE_NUM, &owner_type, -1);
+
+    if (owner_type != pw->owner_type)
+    {
+        pw->owner_type = owner_type;
+
+        /* If type changed, the currently selected owner can't be valid any more
+         * If the initial owner is of the new owner_type, we propose that one
+         * otherwise we just reset the owner
+         */
+        if (gncOwnerGetType (&pw->tx_info->owner) == pw->owner_type)
+            gncOwnerCopy (&pw->tx_info->owner, &pw->owner);
+        else
+        {
+            switch (pw->owner_type)
+            {
+                case GNC_OWNER_VENDOR:
+                    gncOwnerInitVendor (&pw->owner, NULL);
+                    break;
+                case GNC_OWNER_EMPLOYEE:
+                    gncOwnerInitEmployee (&pw->owner, NULL);
+                    break;
+                default:
+                    gncOwnerInitCustomer (&pw->owner, NULL);
+            }
+
+        }
+
+        gnc_payment_dialog_owner_type_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 (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
@@ -960,22 +1111,22 @@ static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
 }
 
 static PaymentWindow *
-new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
+new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_info)
 {
     PaymentWindow *pw;
     GtkBuilder *builder;
-    GtkWidget *box, *label, *credit_box, *debit_box;
+    GtkWidget *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);
+    GtkTreeModel *store;
+    GtkTreeIter iter;
 
     /* Ensure we always have a properly initialized PreExistTxnInfo struct to work with */
     if (!tx_info)
     {
-        tx_info = g_new0 (PreExistTxnInfo, 1);
+        tx_info = g_new0 (InitialPaymentInfo, 1);
+        gncOwnerInitCustomer (&tx_info->owner, NULL);
     }
 
     /*
@@ -984,11 +1135,9 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
      * the window. And update the PreExistTxnInfo (tx_info) for this window.
      */
 
-    pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
+    pw = gnc_find_first_gui_component (DIALOG_PAYMENT_CM_CLASS, find_handler, NULL);
     if (pw)
     {
-        if (gncOwnerIsValid(owner))
-            gnc_payment_set_owner (pw, owner);
 
         // Reset the current
         if (pw->tx_info->lots)
@@ -996,6 +1145,9 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
         g_free (pw->tx_info);
         pw->tx_info = tx_info;
 
+        gncOwnerCopy (&pw->tx_info->owner, &(pw->owner));
+        gnc_payment_set_owner_type (pw, gncOwnerGetType(&pw->tx_info->owner));
+
         gtk_window_present (GTK_WINDOW(pw->dialog));
         return(pw);
     }
@@ -1005,13 +1157,6 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     pw = g_new0 (PaymentWindow, 1);
     pw->book = book;
     pw->tx_info = tx_info;
-    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();
@@ -1019,6 +1164,7 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     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", "owner_type_combo_model");
     gnc_builder_add_from_file (builder, "dialog-payment.glade", "payment_dialog");
     pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
 
@@ -1035,34 +1181,31 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     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.
+    pw->owner_type_combo = GTK_WIDGET (gtk_builder_get_object (builder, "owner_type_combo"));
+    /* Add the respective GNC_OWNER_TYPEs to the combo box model
+     * ATTENTION: the order here should match the order of the
+     * store's entries as set in the glade file !
      */
-    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"));
-    }
+    store = gtk_combo_box_get_model (GTK_COMBO_BOX(pw->owner_type_combo));
+    gtk_tree_model_get_iter_first (store, &iter);
+    gtk_list_store_set (GTK_LIST_STORE(store), &iter,
+                        COL_OWNER_TYPE_NAME, _("Customer"),
+                        COL_OWNER_TYPE_NUM, GNC_OWNER_CUSTOMER, -1);
+    gtk_tree_model_iter_next (store, &iter);
+    gtk_list_store_set (GTK_LIST_STORE(store), &iter,
+                        COL_OWNER_TYPE_NAME, _("Vendor"),
+                        COL_OWNER_TYPE_NUM, GNC_OWNER_VENDOR, -1);
+    gtk_tree_model_iter_next (store, &iter);
+    gtk_list_store_set (GTK_LIST_STORE(store), &iter,
+                        COL_OWNER_TYPE_NAME, _("Employee"),
+                        COL_OWNER_TYPE_NUM, GNC_OWNER_EMPLOYEE, -1);
+
+    pw->owner_box = GTK_WIDGET (gtk_builder_get_object (builder, "owner_box"));
+
+    pw->amount_refund_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_refund_box"));
+    pw->amount_payment_box = GTK_WIDGET (gtk_builder_get_object (builder, "amount_payment_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());
@@ -1071,7 +1214,6 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
                      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());
@@ -1104,7 +1246,7 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     /* 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");
+                                        column, _("Pre-Payment"));
 
     /* Configure document type column */
     column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 2);
@@ -1114,12 +1256,12 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     /* 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");
+                                        column, "9,999,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");
+                                        column, "9,999,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))),
@@ -1132,25 +1274,22 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
     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.
+    /* Set the dialog for the 'new' owner and owner type.
      * Note that this also sets the post account tree. */
-    gnc_payment_dialog_owner_changed(pw);
-
-    if (pw->tx_info->post_acct)
-        gnc_ui_payment_window_set_postaccount (pw, tx_info->post_acct);
-    gnc_payment_dialog_post_to_changed_cb (pw->post_combo, pw);
+    gncOwnerCopy (&pw->tx_info->owner, &(pw->owner));
+    gnc_payment_set_owner_type (pw, gncOwnerGetType (&pw->tx_info->owner));
 
     /* 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);
 
+    g_signal_connect (G_OBJECT (pw->owner_type_combo), "changed",
+                      G_CALLBACK (gnc_payment_dialog_owner_type_changed_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);
@@ -1158,7 +1297,7 @@ new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
 
     /* Register with the component manager */
     pw->component_id =
-        gnc_register_gui_component (cm_class,
+        gnc_register_gui_component (DIALOG_PAYMENT_CM_CLASS,
                                     gnc_payment_window_refresh_handler,
                                     gnc_payment_window_close_handler,
                                     pw);
@@ -1222,22 +1361,24 @@ PaymentWindow *
 gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
                                  GncInvoice *invoice)
 {
-    GncOwner owner_def;
     GNCLot *postlot;
-    PreExistTxnInfo *tx_info;
+    InitialPaymentInfo *tx_info;
 
     if (!book) return NULL;
+
+
+    tx_info = g_new0 (InitialPaymentInfo, 1);
+
     if (owner)
     {
         /* Figure out the company */
-        gncOwnerCopy (gncOwnerGetEndOwner (owner), &owner_def);
+        gncOwnerCopy (gncOwnerGetEndOwner (owner), &tx_info->owner);
     }
     else
     {
-        gncOwnerInitCustomer (&owner_def, NULL);
+        gncOwnerInitCustomer (&tx_info->owner, NULL);
     }
 
-    tx_info = g_new0 (PreExistTxnInfo, 1);
     tx_info->post_acct = gncInvoiceGetPostedAcc (invoice);
 
     postlot = gncInvoiceGetPostedLot (invoice);
@@ -1248,7 +1389,7 @@ gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
         lot_info->amount = gnc_numeric_zero ();
         tx_info->lots = g_list_prepend (tx_info->lots, lot_info);
     }
-    return new_payment_window (&owner_def, book, tx_info);
+    return new_payment_window (NULL, book, tx_info);
 }
 
 PaymentWindow *
@@ -1498,7 +1639,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
 {
     Split *payment_split = NULL;
     Account *post_acct = NULL;
-    PreExistTxnInfo *tx_info = NULL;
+    InitialPaymentInfo *tx_info = NULL;
     GList *txn_lots = NULL;
     gboolean abort = FALSE;
     PaymentWindow *pw;
@@ -1520,12 +1661,13 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         return NULL;
 
     // Fill in the values from the given txn
-    tx_info = g_new0(PreExistTxnInfo, 1);
+    tx_info = g_new0(InitialPaymentInfo, 1);
     tx_info->txn = txn;
     tx_info->post_acct = post_acct;
     tx_info->lots = txn_lots;
+    gncOwnerCopy (owner, &tx_info->owner);
 
-    pw = new_payment_window (owner,
+    pw = new_payment_window (NULL,
                             qof_instance_get_book(QOF_INSTANCE(txn)),
                             tx_info);
 
diff --git a/gnucash/gnome/gtkbuilder/dialog-payment.glade b/gnucash/gnome/gtkbuilder/dialog-payment.glade
index 8b2ff0e..b946e15 100644
--- a/gnucash/gnome/gtkbuilder/dialog-payment.glade
+++ b/gnucash/gnome/gtkbuilder/dialog-payment.glade
@@ -28,6 +28,28 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkListStore" id="owner_type_combo_model">
+    <columns>
+      <!-- column-name Partner -->
+      <column type="gchararray"/>
+      <!-- column-name PartnerType -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Customer</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Vendor</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Employee</col>
+        <col id="1">0</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkListStore" id="post_combo_model">
     <columns>
       <!-- column-name gchararray -->
@@ -129,21 +151,40 @@
                         <property name="tooltip_markup">The company associated with this payment.</property>
                         <property name="tooltip_text" translatable="yes">The company associated with this payment.</property>
                         <property name="border_width">3</property>
+                        <property name="spacing">5</property>
                         <child>
-                          <placeholder/>
+                          <object class="GtkComboBox" id="owner_type_combo">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="model">owner_type_combo_model</property>
+                            <property name="active">0</property>
+                            <property name="entry_text_column">0</property>
+                            <property name="id_column">1</property>
+                            <child>
+                              <object class="GtkCellRendererText" id="Partner Type"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkLabel" id="owner_label">
+                  <object class="GtkLabel" id="owner_frame_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="has_tooltip">True</property>
                     <property name="tooltip_markup">The company associated with this payment.</property>
                     <property name="tooltip_text" translatable="yes">The company associated with this payment.</property>
-                    <property name="label" translatable="yes">(owner)</property>
+                    <property name="label" translatable="yes">Partner</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
                     </attributes>

commit cd9c3807c03404f830104bd9726a061c6282fe88
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Nov 18 17:42:46 2017 +0100

    Assign as payment - when random transaction is selected, reset transaction description to owner
    
    This will make the assigned payment more in line with traditionally created business payments

diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 1035ef9..c6616c5 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -751,6 +751,8 @@ gncOwnerCreatePaymentLot (const GncOwner *owner, Transaction **preset_txn,
 
     if (txn)
     {
+        xaccTransSetDescription (txn, name ? name : "");
+
         /* Pre-existing transaction was specified. We completely clear it,
          * except for the split in the transfer account, unless the
          * transaction can't be reused (wrong currency, wrong transfer account).

commit ce900d1df30d8767ed6f203998364b83687220b2
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 14 15:20:58 2017 +0100

    Assign as payment - refactor a few code blocks into separate functions
    
    And some tweaks to the message strings displayed in case of uncertainty

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index f01c715..efdc193 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1307,6 +1307,29 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
 }
 
 // ///////////////
+static char *gen_split_desc (Transaction *txn, Split *split)
+{
+    gnc_numeric value = xaccSplitGetValue(split);
+    Account *xfer_acct = xaccSplitGetAccount(split);
+    char *acct_name = gnc_account_get_full_name (xfer_acct);
+    const char *action = gnc_get_action_num (txn, split);
+    const char *memo = xaccSplitGetMemo (split);
+    const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (xfer_acct, TRUE));
+    char *split_str = NULL;
+
+    if (action && *action && memo && *memo)
+        split_str = g_strdup_printf ("%s: %s (%s, %s)", acct_name, print_amt,
+                                        action, memo);
+    else if((action && *action) || (memo && *memo))
+        split_str = g_strdup_printf ("%s: %s (%s)", acct_name, print_amt,
+                                        action ? action : memo);
+    else
+        split_str = g_strdup_printf ("%s: %s", acct_name, print_amt);
+    g_free (acct_name);
+
+    return split_str;
+}
+
 static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
 {
     GList *payment_splits = xaccTransGetPaymentAcctSplitList (txn);
@@ -1350,23 +1373,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
         {
             GtkWidget *rbutton;
             Split *split = node->data;
-            gnc_numeric value = xaccSplitGetValue(split);
-            Account *xfer_acct = xaccSplitGetAccount(split);
-            char *acct_name = gnc_account_get_full_name (xfer_acct);
-            const char *action = gnc_get_action_num (txn, split);
-            const char *memo = xaccSplitGetMemo (split);
-            const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (xfer_acct, TRUE));
-            char *split_str = NULL;
-
-            if (action && *action && memo && *memo)
-                split_str = g_strdup_printf ("%s: %s (%s, %s)", acct_name, print_amt,
-                                             action, memo);
-            else if((action && *action) || (memo && *memo))
-                split_str = g_strdup_printf ("%s: %s (%s)", acct_name, print_amt,
-                                             action ? action : memo);
-            else
-                split_str = g_strdup_printf ("%s: %s", acct_name, print_amt);
-            g_free (acct_name);
+            char *split_str = gen_split_desc (txn, split);
 
             if (node == payment_splits)
             {
@@ -1379,6 +1386,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
             g_object_set_data(G_OBJECT(rbutton), "split", split);
             gtk_box_pack_start (GTK_BOX(content), rbutton, FALSE, FALSE, 0);
 
+            g_free (split_str);
         }
 
         gtk_dialog_set_default_response (dialog, GTK_BUTTONS_CANCEL);
@@ -1407,42 +1415,24 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
         return payment_splits->data;
 }
 
-PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
+static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **post_acct, gboolean *abort)
 {
+    gboolean has_no_lot_apar_splits = FALSE;
     SplitList *post_splits = NULL, *no_lot_post_splits = NULL;
     SplitList *iter;
-    Split *payment_split = NULL;
-    gnc_numeric value;
-    Account *xfer_acct, *post_acct = NULL;
-    PaymentWindow *pw;
-    PreExistTxnInfo *tx_info = NULL;
-    GNCLot *postlot = NULL;
     GList *txn_lots = NULL;
-    gboolean has_no_lot_apar_splits = FALSE;
 
-    if (!txn)
-        return NULL;
-
-    // We require the txn to have one split in an Asset account.
-    if (!xaccTransGetSplitList(txn))
-        return NULL;
-
-    payment_split = select_payment_split (parent, txn);
-    if (!payment_split)
+    /* There's no use in continuing if I can't set the post_acct or abort variables */
+    if (!post_acct || !abort)
         return NULL;
 
-    g_assert(payment_split); // we can rely on this because of the check above
-    value = xaccSplitGetValue(payment_split);
-    xfer_acct = xaccSplitGetAccount(payment_split);
+    *abort = FALSE;
+    *post_acct = NULL;
 
-    /* Get all APAR splits */
-    // Prefer true business split (one that's linked to a lot)
-    post_splits = xaccTransGetAPARAcctSplitList (txn, TRUE); // watch out: Might be NULL
-    if (!post_splits)
-        // No true business split found, try again but this time more relaxed
-        post_splits = xaccTransGetAPARAcctSplitList (txn, FALSE); // watch out: Might be NULL
+    post_splits = xaccTransGetAPARAcctSplitList (txn, FALSE);
     for (iter = post_splits; iter; iter = iter->next)
     {
+        GNCLot *postlot = NULL;
         Split *post_split = iter->data;
         postlot = xaccSplitGetLot (post_split);
         if (postlot)
@@ -1451,56 +1441,84 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
             lot_info->lot = postlot;
             lot_info->amount = xaccSplitGetValue (post_split);
             txn_lots = g_list_prepend (txn_lots, lot_info);
-            post_acct = xaccSplitGetAccount (post_split);
+            *post_acct = xaccSplitGetAccount (post_split);
         }
         else
         {
             /* Make sure not to override post_acct if it was set above from a lot split */
-            if (!post_acct)
-                post_acct = xaccSplitGetAccount (post_split);
+            if (!*post_acct)
+                *post_acct = xaccSplitGetAccount (post_split);
             no_lot_post_splits = g_list_prepend (no_lot_post_splits, post_split);
             has_no_lot_apar_splits = TRUE;
         }
     }
 
-    /* If the APAR has both splits linked to a business lot and
+    /* If the txn has both APAR splits linked to a business lot and
      * splits that are not, issue a warning some will be discarded.
      */
     if (has_no_lot_apar_splits && (g_list_length (txn_lots) > 0))
     {
         GtkWidget *dialog;
-        int answer = GTK_BUTTONS_OK;
         char *split_str = g_strdup ("");
         for (iter = no_lot_post_splits; iter; iter = iter->next)
         {
             Split *post_split = iter->data;
-            Account *acct = xaccSplitGetAccount(post_split);
-            const char *acct_name = xaccAccountGetName (acct);
-            const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (acct, TRUE));
-            char *tmp_str = g_strdup_printf("%s%s: %s (%s)\n", split_str, acct_name, print_amt,
-                                            gnc_get_action_num (txn, post_split));
+            char *tmp_str = gen_split_desc (txn, post_split);
+            char *tmp_str2 = g_strconcat(split_str, "• ", tmp_str, "\n", NULL);
+            g_free (tmp_str);
             g_free (split_str);
-            split_str = tmp_str;
+            split_str = tmp_str2;
         }
 
         dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
                                          GTK_DIALOG_DESTROY_WITH_PARENT,
                                          GTK_MESSAGE_WARNING,
                                          GTK_BUTTONS_CANCEL,
-                                         _("The transaction has at least one split in a business account that is not part a business transaction.\n"
+                                         _("The transaction has at least one split in a business account that is not part of a business transaction.\n"
                                          "If you continue these splits will be ignored:\n\n%s\n"
                                          "Do you wish to continue and ignore these splits ?"),
                                          split_str);
         gtk_dialog_add_buttons (GTK_DIALOG(dialog),
                                 _("Continue"), GTK_BUTTONS_OK, NULL);
         gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_BUTTONS_CANCEL);
-        answer = gtk_dialog_run (GTK_DIALOG(dialog));
+        if (gtk_dialog_run (GTK_DIALOG(dialog)) != GTK_BUTTONS_OK)
+        {
+            *abort = TRUE;
+            g_list_free_full (txn_lots, g_free);
+            txn_lots = NULL;
+        }
         gtk_widget_destroy (dialog);
         g_free (split_str);
-        if (answer != GTK_BUTTONS_OK)
-            return NULL;
     }
 
+    return txn_lots;
+}
+
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
+{
+    Split *payment_split = NULL;
+    Account *post_acct = NULL;
+    PreExistTxnInfo *tx_info = NULL;
+    GList *txn_lots = NULL;
+    gboolean abort = FALSE;
+    PaymentWindow *pw;
+
+    if (!txn)
+        return NULL;
+
+    // We require the txn to have one split in an Asset account.
+    if (!xaccTransGetSplitList(txn))
+        return NULL;
+
+    payment_split = select_payment_split (parent, txn);
+    if (!payment_split)
+        return NULL;
+
+    /* Get all APAR related lots. Watch out: there might be none */
+    txn_lots = select_txn_lots (parent, txn, &post_acct, &abort);
+    if (abort)
+        return NULL;
+
     // Fill in the values from the given txn
     tx_info = g_new0(PreExistTxnInfo, 1);
     tx_info->txn = txn;
@@ -1517,7 +1535,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         GDate txn_date = xaccTransGetDatePostedGDate (txn);
         gnc_ui_payment_window_set_date(pw, &txn_date);
     }
-    gnc_ui_payment_window_set_amount(pw, value);
-    gnc_ui_payment_window_set_xferaccount(pw, xfer_acct);
+    gnc_ui_payment_window_set_amount(pw, xaccSplitGetValue(payment_split));
+    gnc_ui_payment_window_set_xferaccount(pw, xaccSplitGetAccount(payment_split));
     return pw;
 }

commit d66469fef8b49d038256f07a1642867ce65e200c
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 14 11:17:53 2017 +0100

    Assign as payment - Differentiate between new and existing payments for 'Assign as payment'
    
    When the selected transaction is already involved in a business payment,
    propose to Edit the payment instead of Assigning it as a payment.
    This is more informative and will help prevent users from accidentally replacing existing payments.

diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 32d3132..5b1efca 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -319,6 +319,11 @@ static GtkActionEntry gnc_plugin_actions [] =
         N_("Assign the selected transaction as payment"),
         G_CALLBACK (gnc_plugin_business_cmd_assign_payment)
     },
+    {
+        "RegisterEditPayment", NULL, N_("Edit payment..."), NULL,
+        N_("Edit the payment this transaction is a part of"),
+        G_CALLBACK (gnc_plugin_business_cmd_assign_payment)
+    },
 };
 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
 
@@ -888,12 +893,18 @@ static const gchar *register_txn_actions[] =
     NULL
 };
 
+static const gchar *register_bus_txn_actions[] =
+{
+    "RegisterEditPayment",
+    NULL
+};
+
 static void
 gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
 {
     GncMainWindow  *window;
     GtkActionGroup *action_group;
-    gboolean is_txn_register;
+    gboolean is_txn_register, is_bus_txn = FALSE;
 
     // We continue only if the current page is a plugin page
     if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
@@ -905,11 +916,21 @@ gnc_plugin_business_update_menus (GncPluginPage *plugin_page)
     action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);
     g_return_if_fail(GTK_IS_ACTION_GROUP(action_group));
 
+    if (is_txn_register)
+    {
+        Transaction *trans = gnc_plugin_page_register_get_current_txn (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
+        if (xaccTransCountSplits(trans) > 0)
+            is_bus_txn = (xaccTransGetFirstAPARAcctSplit(trans, TRUE) != NULL);
+    }
     // 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);
+                               "sensitive", is_txn_register && !is_bus_txn);
     gnc_plugin_update_actions (action_group, register_txn_actions,
-                               "visible", is_txn_register);
+                               "visible", is_txn_register && !is_bus_txn);
+    gnc_plugin_update_actions (action_group, register_bus_txn_actions,
+                               "sensitive", is_txn_register && is_bus_txn);
+    gnc_plugin_update_actions (action_group, register_bus_txn_actions,
+                               "visible", is_txn_register && is_bus_txn);
 }
 
 
@@ -921,6 +942,12 @@ static void gnc_plugin_business_main_window_page_changed(GncMainWindow *window,
     update_inactive_actions(page);
 }
 
+
+void gnc_plugin_business_split_reg_ui_update (GncPluginPage *plugin_page)
+{
+    gnc_plugin_business_main_window_page_changed(NULL, plugin_page, NULL);
+}
+
 static void
 gnc_plugin_business_cmd_test_init_data (GtkAction *action,
                                         GncMainWindowActionData *data)
@@ -1011,6 +1038,7 @@ static const gchar* readonly_inactive_actions[] =
     "EmployeeProcessPaymentAction",
     "ToolbarNewInvoiceAction",
     "RegisterAssignPayment",
+    "RegisterEditPayment",
     NULL
 };
 
diff --git a/gnucash/gnome/gnc-plugin-business.h b/gnucash/gnome/gnc-plugin-business.h
index fe7f9d5..9a0e72c 100644
--- a/gnucash/gnome/gnc-plugin-business.h
+++ b/gnucash/gnome/gnc-plugin-business.h
@@ -66,4 +66,8 @@ void gnc_invoice_remind_bills_due_cb (void);
 void gnc_invoice_remind_invoices_due_cb (void);
 const char *gnc_plugin_business_get_invoice_printreport(void);
 
+
+void gnc_plugin_business_split_reg_ui_update (GncPluginPage *plugin_page);
+
+
 #endif /* __GNC_PLUGIN_BUSINESS_H */
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index c34dbb9..d0cab8e 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -48,6 +48,7 @@
 #include "gnc-plugin-register.h"
 #include "gnc-plugin-menu-additions.h"
 #include "gnc-plugin-page-report.h"
+#include "gnc-plugin-business.h"
 
 #include "dialog-account.h"
 #include "dialog-find-account.h"
@@ -823,6 +824,17 @@ gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
     return NULL;
 }
 
+Transaction *
+gnc_plugin_page_register_get_current_txn (GncPluginPageRegister *page)
+{
+    GncPluginPageRegisterPrivate *priv;
+    SplitRegister *reg;
+
+    priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
+    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    return gnc_split_register_get_current_trans(reg);
+}
+
 /* This is the list of actions which are switched inactive in a read-only book. */
 static const char* readonly_inactive_actions[] =
 {
@@ -949,10 +961,9 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
     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);
+    gtk_action_set_sensitive (GTK_ACTION(action), (uri && *uri));
+
+    gnc_plugin_business_split_reg_ui_update (GNC_PLUGIN_PAGE(page));
 
     /* If we are in a readonly book, make any modifying action inactive */
     if (qof_book_is_readonly(gnc_get_current_book()))
diff --git a/gnucash/gnome/gnc-plugin-page-register.h b/gnucash/gnome/gnc-plugin-page-register.h
index 23af07f..43b2b2e 100644
--- a/gnucash/gnome/gnc-plugin-page-register.h
+++ b/gnucash/gnome/gnc-plugin-page-register.h
@@ -153,6 +153,16 @@ gnc_plugin_page_register_get_query (GncPluginPage *plugin_page);
 Account *
 gnc_plugin_page_register_get_account (GncPluginPageRegister *page);
 
+/** Get the currently selected transaction in this register page.
+ *
+ *  @param page A "register" page.
+ *
+ *  @return The currently active transaction or NULL if there currently
+ *  is no currently selected.
+ */
+Transaction *
+gnc_plugin_page_register_get_current_txn (GncPluginPageRegister *page);
+
 G_END_DECLS
 /** @} */
 /** @} */
diff --git a/gnucash/gnome/ui/gnc-plugin-business-ui.xml b/gnucash/gnome/ui/gnc-plugin-business-ui.xml
index 313b23f..b29d897 100644
--- a/gnucash/gnome/ui/gnc-plugin-business-ui.xml
+++ b/gnucash/gnome/ui/gnc-plugin-business-ui.xml
@@ -2,7 +2,8 @@
   <menubar>
     <menu name="Edit" action="EditAction">
       <placeholder name="EditSelectedPlaceholder">
-        <menuitem name="RegisterAssignPayment"       action="RegisterAssignPayment"/>
+          <menuitem name="RegisterAssignPayment"       action="RegisterAssignPayment"/>
+          <menuitem name="RegisterEditPayment"       action="RegisterEditPayment"/>
       </placeholder>
     </menu>
 
@@ -73,7 +74,8 @@
   <popup name="MainPopup" action="FakeToplevel">
     <!--separator name="PopupSep3"/-->
     <placeholder name="PopupPlaceholder3">
-      <menuitem name="RegisterAssignPayment"       action="RegisterAssignPayment"/>
+        <menuitem name="RegisterAssignPayment"       action="RegisterAssignPayment"/>
+        <menuitem name="RegisterEditPayment"       action="RegisterEditPayment"/>
     </placeholder>
   </popup>
 </ui>

commit 18dcbeef8a9ba7213bdd14c7260c8b2d683a0168
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 14 13:56:56 2017 +0100

    Assign as payment - offer possible payment splits to user in case there are multiple valid candidates for assignment

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index aea390a..f01c715 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1307,27 +1307,9 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
 }
 
 // ///////////////
-
-PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
+static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
 {
-    SplitList *payment_splits = NULL, *post_splits = NULL, *no_lot_post_splits = NULL;
-    SplitList *iter;
-    gnc_numeric value;
-    Account *xfer_acct, *post_acct = NULL;
-    PaymentWindow *pw;
-    PreExistTxnInfo *tx_info = NULL;
-    GNCLot *postlot = NULL;
-    GList *txn_lots = NULL;
-    gboolean has_no_lot_apar_splits = FALSE;
-
-    if (!txn)
-        return NULL;
-
-    // We require the txn to have one split in an Asset account.
-    if (!xaccTransGetSplitList(txn))
-        return NULL;
-
-    payment_splits = xaccTransGetPaymentAcctSplitList (txn);
+    GList *payment_splits = xaccTransGetPaymentAcctSplitList (txn);
     if (!payment_splits)
     {
 
@@ -1344,33 +1326,114 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         return NULL;
     }
 
-    g_assert(payment_splits->data); // we can rely on this because of the check above
-    value = xaccSplitGetValue(payment_splits->data);
-    xfer_acct = xaccSplitGetAccount(payment_splits->data);
-
     if (g_list_length(payment_splits) > 1)
     {
+        Split *selected_split = NULL;
+        GList *node;
+        GtkWidget *first_rb;
         int answer = GTK_BUTTONS_OK;
-        const char *acct_name = xaccAccountGetName (xfer_acct);
-        const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (xfer_acct, TRUE));
-        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
-                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                    GTK_MESSAGE_WARNING,
-                                                    GTK_BUTTONS_CANCEL,
-                                                    _("The transaction has multiple splits that can be considered as 'the payment split'.\n"
-                                                    "If you continue only the following split will be used:\n\n"
-                                                    "%s: %s (%s)\n\n"
-                                                    "Do you wish to continue and ignore the other possible payment splits ?"),
-                                                    acct_name, print_amt,
-                                                    gnc_get_action_num (txn, payment_splits->data));
-        gtk_dialog_add_buttons (GTK_DIALOG(dialog),
-                                _("Continue"), GTK_BUTTONS_OK, NULL);
-        gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_BUTTONS_CANCEL);
-        answer = gtk_dialog_run (GTK_DIALOG(dialog));
-        gtk_widget_destroy (dialog);
-        if (answer != GTK_BUTTONS_OK)
-            return NULL;
+        const char *message = _("While this transaction has multiple splits that can be considered\nas 'the payment split', gnucash only knows how to handle one.\n"
+                                "Please select one, the others will be ignored.\n\n");
+        GtkDialog *dialog = GTK_DIALOG(
+                            gtk_dialog_new_with_buttons (_("Warning"),
+                                                         GTK_WINDOW(parent),
+                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                         _("Continue"), GTK_BUTTONS_OK,
+                                                         _("Cancel"), GTK_BUTTONS_CANCEL,
+                                                         NULL));
+        GtkWidget *content = gtk_dialog_get_content_area(dialog);
+        GtkWidget *label = gtk_label_new (message);
+        gtk_box_pack_start (GTK_BOX(content), label, FALSE, TRUE, 0);
+
+        /* Add splits as selectable options to the dialog */
+        for (node = payment_splits; node; node = node->next)
+        {
+            GtkWidget *rbutton;
+            Split *split = node->data;
+            gnc_numeric value = xaccSplitGetValue(split);
+            Account *xfer_acct = xaccSplitGetAccount(split);
+            char *acct_name = gnc_account_get_full_name (xfer_acct);
+            const char *action = gnc_get_action_num (txn, split);
+            const char *memo = xaccSplitGetMemo (split);
+            const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (xfer_acct, TRUE));
+            char *split_str = NULL;
+
+            if (action && *action && memo && *memo)
+                split_str = g_strdup_printf ("%s: %s (%s, %s)", acct_name, print_amt,
+                                             action, memo);
+            else if((action && *action) || (memo && *memo))
+                split_str = g_strdup_printf ("%s: %s (%s)", acct_name, print_amt,
+                                             action ? action : memo);
+            else
+                split_str = g_strdup_printf ("%s: %s", acct_name, print_amt);
+            g_free (acct_name);
+
+            if (node == payment_splits)
+            {
+                first_rb = gtk_radio_button_new_with_label (NULL, split_str);
+                rbutton = first_rb;
+            }
+            else
+                rbutton = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(first_rb), split_str);
+
+            g_object_set_data(G_OBJECT(rbutton), "split", split);
+            gtk_box_pack_start (GTK_BOX(content), rbutton, FALSE, FALSE, 0);
+
+        }
+
+        gtk_dialog_set_default_response (dialog, GTK_BUTTONS_CANCEL);
+        gtk_widget_show_all (GTK_WIDGET(dialog));
+        answer = gtk_dialog_run (dialog);
+
+        if (answer == GTK_BUTTONS_OK)
+        {
+            GSList *rbgroup = gtk_radio_button_get_group(GTK_RADIO_BUTTON(first_rb));
+            GSList *rbnode;
+            for (rbnode = rbgroup; rbnode; rbnode = rbnode->next)
+            {
+                GtkWidget *rbutton = rbnode->data;
+                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(rbutton)))
+                {
+                    selected_split = g_object_get_data(G_OBJECT(rbutton), "split");
+                    break;
+                }
+            }
+        }
+
+        gtk_widget_destroy (GTK_WIDGET(dialog));
+        return selected_split;
     }
+    else
+        return payment_splits->data;
+}
+
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
+{
+    SplitList *post_splits = NULL, *no_lot_post_splits = NULL;
+    SplitList *iter;
+    Split *payment_split = NULL;
+    gnc_numeric value;
+    Account *xfer_acct, *post_acct = NULL;
+    PaymentWindow *pw;
+    PreExistTxnInfo *tx_info = NULL;
+    GNCLot *postlot = NULL;
+    GList *txn_lots = NULL;
+    gboolean has_no_lot_apar_splits = FALSE;
+
+    if (!txn)
+        return NULL;
+
+    // We require the txn to have one split in an Asset account.
+    if (!xaccTransGetSplitList(txn))
+        return NULL;
+
+    payment_split = select_payment_split (parent, txn);
+    if (!payment_split)
+        return NULL;
+
+    g_assert(payment_split); // we can rely on this because of the check above
+    value = xaccSplitGetValue(payment_split);
+    xfer_acct = xaccSplitGetAccount(payment_split);
 
     /* Get all APAR splits */
     // Prefer true business split (one that's linked to a lot)
@@ -1448,7 +1511,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
                             qof_instance_get_book(QOF_INSTANCE(txn)),
                             tx_info);
 
-    gnc_ui_payment_window_set_num(pw, gnc_get_num_action (txn, payment_splits->data));
+    gnc_ui_payment_window_set_num(pw, gnc_get_num_action (txn, payment_split));
     gnc_ui_payment_window_set_memo(pw, xaccTransGetDescription(txn));
     {
         GDate txn_date = xaccTransGetDatePostedGDate (txn);

commit aeb80a230e3cf0929c1251f110ad69bf81a13f74
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 9 22:56:52 2017 +0100

    Bug 734865 - Assign as Payment... can silently 'unpay' a payed invoice
    
    With this commit the 'assign as payment' logic now works as follows:
    - if the selected transaction is already linked to an existing payment, the payment dialog
      will present this payment again (same partner, post-to account, same selected document(s),
      same amount, memo, and transfer account).
    - if the selected transaction is not linked to an existing business transaction the logic
      will make a best guess as to whether the payment should be for a customer or vendor.
    - in both situations if the existing transaction has multiple splits that can be considered
      as transfer (or 'payment') splits the payment  dialog can't work with it (it can only deal
      with one transfer split). In this case the user will be informed that only one valid
      transfer split will be retained and the others ignored.
    - the other thing the payment dialog can't handle are APAR type splits that are not associated
      to a lot at all. In case of transactions not part of a business transaction they will be
      silently ignored on the assumptions these were manually entered transactions with the intention
      to be linked to business transactions. On the other hand if such a split is part of a transaction
      that is also linked to a business payment already, a warning will be issued these splits will
      be removed from the new payment.

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index a2408f5..aea390a 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -57,6 +57,19 @@
 #define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
 #define DIALOG_PAYMENT_VENDOR_CM_CLASS "vendor-payment-dialog"
 
+typedef struct
+{
+    GNCLot      * lot;
+    gnc_numeric   amount;
+} PreExistLotInfo;
+
+typedef struct
+{
+    Transaction * txn;
+    Account     * post_acct;
+    GList       * lots;
+} PreExistTxnInfo;
+
 struct _payment_window
 {
     GtkWidget   * dialog;
@@ -78,14 +91,13 @@ struct _payment_window
     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;
+    PreExistTxnInfo *tx_info;
     gboolean      print_check_state;
 };
 
@@ -164,7 +176,7 @@ void gnc_ui_payment_window_set_xferaccount (PaymentWindow *pw, const Account* ac
 
 static gboolean gnc_payment_dialog_has_pre_existing_txn(const PaymentWindow* pw)
 {
-    return pw->pre_existing_txn != NULL;
+    return pw->tx_info->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);
@@ -334,52 +346,61 @@ gnc_payment_dialog_document_selection_changed (PaymentWindow *pw)
     gnc_ui_payment_window_set_amount(pw, val);
 }
 
+static gint
+_gnc_lotinfo_find_by_lot(PreExistLotInfo *lotinfo_inst, GNCLot *lot_to_find)
+{
+    if (lotinfo_inst->lot == lot_to_find)
+        return 0;
+    return -1;
+}
+
 static void
-gnc_payment_dialog_highlight_document (PaymentWindow *pw)
+gnc_payment_dialog_highlight_documents (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);
+    gboolean selection_changed = FALSE;
+    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))
+    if (gtk_tree_model_get_iter_first (model, &iter))
+    {
+        do
         {
-            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);
+            GValue value = { 0 };
+            GNCLot *lot;
+            GList *li_node;
 
-                if (!lot)
-                    continue; /* Lot has been deleted behind our back... */
+            gtk_tree_model_get_value (model, &iter, 5, &value);
+            lot = (GNCLot *) g_value_get_pointer (&value);
+            g_value_unset (&value);
 
-                invoice = gncInvoiceGetInvoiceFromLot (lot);
-                if (!invoice)
-                    continue;
+            if (!lot)
+                continue; /* Lot has been deleted behind our back... */
 
-                if (pw->invoice == invoice)
-                {
-                    gtk_tree_selection_select_iter (selection, &iter);
-                    gnc_payment_dialog_document_selection_changed (pw);
-                }
+            li_node = g_list_find_custom (pw->tx_info->lots, lot,
+                                            (GCompareFunc)_gnc_lotinfo_find_by_lot);
+            if (li_node)
+            {
+                gtk_tree_selection_select_iter (selection, &iter);
+                selection_changed = TRUE;
             }
-            while (gtk_tree_model_iter_next (model, &iter));
         }
+        while (gtk_tree_model_iter_next (model, &iter));
     }
+
+    if (selection_changed)
+        gnc_payment_dialog_document_selection_changed (pw);
 }
 
+
 void
 gnc_payment_window_fill_docs_list (PaymentWindow *pw)
 {
     GtkListStore *store;
     GtkTreeSelection *selection;
     GList *list = NULL, *node;
+    GNCLot *tx_lot = NULL;
 
     g_return_if_fail (pw->docs_list_tree_view && GTK_IS_TREE_VIEW(pw->docs_list_tree_view));
 
@@ -388,6 +409,50 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
         list = xaccAccountFindOpenLots (pw->post_acct, gncOwnerLotMatchOwnerFunc,
                                         &pw->owner, NULL);
 
+    /* If pre-existing transaction's post account equals the selected post account
+     * and we have lots for this transaction then compensate the document list for those.
+     * The presence of such lots indicates the pre-existing transaction is an existing payment that
+     * we are about to replace. So we should make sure this existing payment info can be reselected
+     * by the user (within the practical limits of the payment window*) to redo the same
+     * payment again.
+     * If the txn's lots are closed they are ignored by default so we should explicitly readd
+     * them here.
+     * And for all lots in the pre-existing transaction we need to readd the split amount
+     * for that lot or the existing payment values would not be taken into account.
+     * This will happen further below though.
+     *
+     * Finally all this is only relevant if the lot belongs to the same owner...
+     *
+     * * The practical limits are
+     * - The payment dialog can handle only one transfer split. If the pre-existing
+     *   transaction has more possible candidates, all but the first will be used
+     * - The payment dialog can't handle AR/AP splits that aren't linked to a lot
+     *   in the current post account. Such splits will be ignored as well.
+     * In both cases the user will have been informed before and given the option to abort.
+     */
+    if (pw->tx_info->post_acct == pw->post_acct)
+        for (node = pw->tx_info->lots; node; node = node->next)
+        {
+            PreExistLotInfo *lot_info = node->data;
+            if (!gnc_numeric_zero_p (gnc_lot_get_balance (lot_info->lot)))
+                /* This case will be handled below when the lot is processed as part of the open lots */
+                tx_lot = lot_info->lot;
+            else
+            {
+                GncOwner lotowner;
+                if (!gncOwnerGetOwnerFromLot(lot_info->lot, &lotowner))
+                {
+                    const GncOwner *owner;
+                    const GncInvoice *invoice = gncInvoiceGetInvoiceFromLot(lot_info->lot);
+                    if (invoice)
+                        owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
+                    gncOwnerCopy (owner, &lotowner);
+                }
+                if (gncOwnerEqual(&pw->owner, &lotowner))
+                    list = g_list_prepend (list, lot_info->lot);
+            }
+        }
+
     /* Clear the existing list */
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
     gtk_tree_selection_unselect_all (selection);
@@ -398,6 +463,7 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
     for (node = list; node; node = node->next)
     {
         GNCLot *lot = node->data;
+        GList *li_node;
         time64 doc_date_time = 0;
         const gchar *doc_type_str = NULL;
         const gchar *doc_id_str   = NULL;
@@ -449,11 +515,26 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
          */
         value = gnc_lot_get_balance (lot);
 
+        /* If this lot is linked to the pre-existing transaction, compensate
+         * its amount so the same pre-existing transaction can be reselected bye the user
+         * (within applicable limits)
+         */
+        li_node = g_list_find_custom (pw->tx_info->lots, lot,
+                                      (GCompareFunc)_gnc_lotinfo_find_by_lot);
+        if (li_node)
+        {
+            PreExistLotInfo *lot_info = li_node->data;
+            value = gnc_numeric_sub(value, lot_info->amount,
+                                    gnc_commodity_get_fraction (xaccAccountGetCommodity (pw->post_acct)),
+                                    GNC_HOW_RND_ROUND_HALF_UP);
+        }
+
         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));
@@ -475,7 +556,7 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
     g_list_free (list);
 
     /* Highlight the preset invoice if it's in the new list */
-    gnc_payment_dialog_highlight_document (pw);
+    gnc_payment_dialog_highlight_documents (pw);
 }
 
 static void
@@ -485,9 +566,6 @@ gnc_payment_dialog_owner_changed (PaymentWindow *pw)
     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),
@@ -621,14 +699,14 @@ gnc_payment_dialog_post_to_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer
 
     post_acct = gnc_account_select_combo_get_active (pw->post_combo);
 
-    /* If this invoice really changed, then reset ourselves */
+    /* If this post account 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);
+        gnc_payment_dialog_highlight_documents (pw);
 
     /* Reflect if the payment could complete now */
     gnc_payment_window_check_payment (pw);
@@ -740,7 +818,7 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
         else
             auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
 
-        gncOwnerApplyPayment (&pw->owner, &(pw->pre_existing_txn), selected_lots,
+        gncOwnerApplyPayment (&pw->owner, &(pw->tx_info->txn), selected_lots,
                               pw->post_acct, pw->xfer_acct, pw->amount_tot, exch,
                               ts, memo, num, auto_pay);
     }
@@ -752,7 +830,7 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
     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);
+        Split *split = xaccTransFindSplitByAccount (pw->tx_info->txn, pw->xfer_acct);
         GList *splits = NULL;
         splits = g_list_append(splits, split);
         gnc_ui_print_check_dialog_create(NULL, splits);
@@ -779,6 +857,8 @@ gnc_payment_window_destroy_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 
     g_list_free (pw->acct_types);
     g_list_free (pw->acct_commodities);
+    if (pw->tx_info->lots)
+        g_list_free_full (pw->tx_info->lots, g_free);
     g_free (pw);
 }
 
@@ -880,7 +960,7 @@ static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
 }
 
 static PaymentWindow *
-new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
+new_payment_window (GncOwner *owner, QofBook *book, PreExistTxnInfo *tx_info)
 {
     PaymentWindow *pw;
     GtkBuilder *builder;
@@ -892,10 +972,16 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
                        DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
                        DIALOG_PAYMENT_VENDOR_CM_CLASS);
 
+    /* Ensure we always have a properly initialized PreExistTxnInfo struct to work with */
+    if (!tx_info)
+    {
+        tx_info = g_new0 (PreExistTxnInfo, 1);
+    }
+
     /*
      * Find an existing payment window.  If found, bring it to
      * the front.  If we have an actual owner, then set it in
-     * the window.
+     * the window. And update the PreExistTxnInfo (tx_info) for this window.
      */
 
     pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
@@ -904,8 +990,11 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
         if (gncOwnerIsValid(owner))
             gnc_payment_set_owner (pw, owner);
 
-        // Reset the setting about the pre-existing TXN
-        pw->pre_existing_txn = NULL;
+        // Reset the current
+        if (pw->tx_info->lots)
+            g_list_free_full (pw->tx_info->lots, g_free);
+        g_free (pw->tx_info);
+        pw->tx_info = tx_info;
 
         gtk_window_present (GTK_WINDOW(pw->dialog));
         return(pw);
@@ -915,6 +1004,7 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
 
     pw = g_new0 (PaymentWindow, 1);
     pw->book = book;
+    pw->tx_info = tx_info;
     gncOwnerCopy (owner, &(pw->owner));
 
     /* Compute the post-to account types */
@@ -1046,19 +1136,9 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
      * 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);
-        }
-    }
+    if (pw->tx_info->post_acct)
+        gnc_ui_payment_window_set_postaccount (pw, tx_info->post_acct);
+    gnc_payment_dialog_post_to_changed_cb (pw->post_combo, pw);
 
     /* Setup signals */
     gtk_builder_connect_signals_full( builder,
@@ -1134,6 +1214,7 @@ void
 gnc_ui_payment_window_destroy (PaymentWindow *pw)
 {
     if (!pw) return;
+
     gnc_close_gui_component (pw->component_id);
 }
 
@@ -1142,6 +1223,8 @@ gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
                                  GncInvoice *invoice)
 {
     GncOwner owner_def;
+    GNCLot *postlot;
+    PreExistTxnInfo *tx_info;
 
     if (!book) return NULL;
     if (owner)
@@ -1154,7 +1237,18 @@ gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
         gncOwnerInitCustomer (&owner_def, NULL);
     }
 
-    return new_payment_window (&owner_def, book, invoice);
+    tx_info = g_new0 (PreExistTxnInfo, 1);
+    tx_info->post_acct = gncInvoiceGetPostedAcc (invoice);
+
+    postlot = gncInvoiceGetPostedLot (invoice);
+    if (postlot)
+    {
+        PreExistLotInfo *lot_info = g_new0 (PreExistLotInfo, 1);
+        lot_info->lot = postlot;
+        lot_info->amount = gnc_numeric_zero ();
+        tx_info->lots = g_list_prepend (tx_info->lots, lot_info);
+    }
+    return new_payment_window (&owner_def, book, tx_info);
 }
 
 PaymentWindow *
@@ -1216,21 +1310,25 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
 
 PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
 {
-    Split *assetaccount_split;
-    Split *postaccount_split;
-    gnc_numeric amount;
+    SplitList *payment_splits = NULL, *post_splits = NULL, *no_lot_post_splits = NULL;
+    SplitList *iter;
+    gnc_numeric value;
+    Account *xfer_acct, *post_acct = NULL;
     PaymentWindow *pw;
+    PreExistTxnInfo *tx_info = NULL;
+    GNCLot *postlot = NULL;
+    GList *txn_lots = NULL;
+    gboolean has_no_lot_apar_splits = FALSE;
 
     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)
+    payment_splits = xaccTransGetPaymentAcctSplitList (txn);
+    if (!payment_splits)
     {
 
         GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
@@ -1246,30 +1344,117 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         return NULL;
     }
 
+    g_assert(payment_splits->data); // we can rely on this because of the check above
+    value = xaccSplitGetValue(payment_splits->data);
+    xfer_acct = xaccSplitGetAccount(payment_splits->data);
+
+    if (g_list_length(payment_splits) > 1)
+    {
+        int answer = GTK_BUTTONS_OK;
+        const char *acct_name = xaccAccountGetName (xfer_acct);
+        const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (xfer_acct, TRUE));
+        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_WARNING,
+                                                    GTK_BUTTONS_CANCEL,
+                                                    _("The transaction has multiple splits that can be considered as 'the payment split'.\n"
+                                                    "If you continue only the following split will be used:\n\n"
+                                                    "%s: %s (%s)\n\n"
+                                                    "Do you wish to continue and ignore the other possible payment splits ?"),
+                                                    acct_name, print_amt,
+                                                    gnc_get_action_num (txn, payment_splits->data));
+        gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                                _("Continue"), GTK_BUTTONS_OK, NULL);
+        gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_BUTTONS_CANCEL);
+        answer = gtk_dialog_run (GTK_DIALOG(dialog));
+        gtk_widget_destroy (dialog);
+        if (answer != GTK_BUTTONS_OK)
+            return NULL;
+    }
+
+    /* Get all APAR splits */
     // Prefer true business split (one that's linked to a lot)
-    postaccount_split = xaccTransGetFirstAPARAcctSplit(txn, TRUE); // watch out: Might be NULL
-    if (!postaccount_split)
+    post_splits = xaccTransGetAPARAcctSplitList (txn, TRUE); // watch out: Might be NULL
+    if (!post_splits)
         // No true business split found, try again but this time more relaxed
-        postaccount_split = xaccTransGetFirstAPARAcctSplit(txn, FALSE); // watch out: Might be NULL
-    amount = xaccSplitGetValue(assetaccount_split);
+        post_splits = xaccTransGetAPARAcctSplitList (txn, FALSE); // watch out: Might be NULL
+    for (iter = post_splits; iter; iter = iter->next)
+    {
+        Split *post_split = iter->data;
+        postlot = xaccSplitGetLot (post_split);
+        if (postlot)
+        {
+            PreExistLotInfo *lot_info = g_new0 (PreExistLotInfo, 1);
+            lot_info->lot = postlot;
+            lot_info->amount = xaccSplitGetValue (post_split);
+            txn_lots = g_list_prepend (txn_lots, lot_info);
+            post_acct = xaccSplitGetAccount (post_split);
+        }
+        else
+        {
+            /* Make sure not to override post_acct if it was set above from a lot split */
+            if (!post_acct)
+                post_acct = xaccSplitGetAccount (post_split);
+            no_lot_post_splits = g_list_prepend (no_lot_post_splits, post_split);
+            has_no_lot_apar_splits = TRUE;
+        }
+    }
 
-    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));
+    /* If the APAR has both splits linked to a business lot and
+     * splits that are not, issue a warning some will be discarded.
+     */
+    if (has_no_lot_apar_splits && (g_list_length (txn_lots) > 0))
+    {
+        GtkWidget *dialog;
+        int answer = GTK_BUTTONS_OK;
+        char *split_str = g_strdup ("");
+        for (iter = no_lot_post_splits; iter; iter = iter->next)
+        {
+            Split *post_split = iter->data;
+            Account *acct = xaccSplitGetAccount(post_split);
+            const char *acct_name = xaccAccountGetName (acct);
+            const char *print_amt = xaccPrintAmount(value, gnc_account_print_info (acct, TRUE));
+            char *tmp_str = g_strdup_printf("%s%s: %s (%s)\n", split_str, acct_name, print_amt,
+                                            gnc_get_action_num (txn, post_split));
+            g_free (split_str);
+            split_str = tmp_str;
+        }
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         GTK_MESSAGE_WARNING,
+                                         GTK_BUTTONS_CANCEL,
+                                         _("The transaction has at least one split in a business account that is not part a business transaction.\n"
+                                         "If you continue these splits will be ignored:\n\n%s\n"
+                                         "Do you wish to continue and ignore these splits ?"),
+                                         split_str);
+        gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                                _("Continue"), GTK_BUTTONS_OK, NULL);
+        gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_BUTTONS_CANCEL);
+        answer = gtk_dialog_run (GTK_DIALOG(dialog));
+        gtk_widget_destroy (dialog);
+        g_free (split_str);
+        if (answer != GTK_BUTTONS_OK)
+            return NULL;
+    }
 
     // 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));
+    tx_info = g_new0(PreExistTxnInfo, 1);
+    tx_info->txn = txn;
+    tx_info->post_acct = post_acct;
+    tx_info->lots = txn_lots;
+
+    pw = new_payment_window (owner,
+                            qof_instance_get_book(QOF_INSTANCE(txn)),
+                            tx_info);
+
+    gnc_ui_payment_window_set_num(pw, gnc_get_num_action (txn, payment_splits->data));
     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));
-
+    gnc_ui_payment_window_set_amount(pw, value);
+    gnc_ui_payment_window_set_xferaccount(pw, xfer_acct);
     return pw;
 }

commit 0dfb921e86357df280ded13c7cd1ce9da139f8c4
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Nov 13 19:15:04 2017 +0100

    Add functions to retrieve a copy of splits of a certain type from business transactions

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index c87e949..a2408f5 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1179,7 +1179,11 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
 
     /* 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);
+    // Prefer true business split (one that's linked to a lot)
+    aparaccount_split = xaccTransGetFirstAPARAcctSplit(txn, TRUE);
+    if (!aparaccount_split)
+        // No true business split found, try again but this time more relaxed
+        aparaccount_split = xaccTransGetFirstAPARAcctSplit(txn, FALSE);
     if (aparaccount_split)
     {
         if (xaccAccountGetType (xaccSplitGetAccount (aparaccount_split)) == ACCT_TYPE_RECEIVABLE)
@@ -1242,7 +1246,11 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
         return NULL;
     }
 
-    postaccount_split = xaccTransGetFirstAPARAcctSplit(txn); // watch out: Might be NULL
+    // Prefer true business split (one that's linked to a lot)
+    postaccount_split = xaccTransGetFirstAPARAcctSplit(txn, TRUE); // watch out: Might be NULL
+    if (!postaccount_split)
+        // No true business split found, try again but this time more relaxed
+        postaccount_split = xaccTransGetFirstAPARAcctSplit(txn, FALSE); // watch out: Might be NULL
     amount = xaccSplitGetValue(assetaccount_split);
 
     pw = gnc_ui_payment_new(owner,
diff --git a/libgnucash/engine/Transaction.c b/libgnucash/engine/Transaction.c
index c5d910d..b6c9264 100644
--- a/libgnucash/engine/Transaction.c
+++ b/libgnucash/engine/Transaction.c
@@ -66,6 +66,8 @@ struct timeval
 #include "SchedXaction.h"
 #include "gncBusiness.h"
 #include <qofinstance-p.h>
+#include "gncInvoice.h"
+#include "gncOwner.h"
 
 /* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and
  *  xaccTransRollback():
@@ -2241,23 +2243,76 @@ xaccTransGetSplitList (const Transaction *trans)
     return trans ? trans->splits : NULL;
 }
 
+SplitList *
+xaccTransGetPaymentAcctSplitList (const Transaction *trans)
+{
+    GList *pay_splits = NULL;
+    FOR_EACH_SPLIT (trans,
+                    const Account *account = xaccSplitGetAccount(s);
+                    if (account && gncBusinessIsPaymentAcctType(xaccAccountGetType(account)))
+                        pay_splits = g_list_prepend (pay_splits, s);
+    );
+
+    pay_splits = g_list_reverse (pay_splits);
+    return pay_splits;
+}
+
+SplitList *
+xaccTransGetAPARAcctSplitList (const Transaction *trans, gboolean strict)
+{
+    GList *apar_splits = NULL;
+    FOR_EACH_SPLIT (trans,
+                    const Account *account = xaccSplitGetAccount(s);
+                    if (account && xaccAccountIsAPARType(xaccAccountGetType(account)))
+                    {
+
+                        if (!strict)
+                            apar_splits = g_list_prepend (apar_splits, s);
+                        else
+                        {
+                            GncOwner owner;
+                            GNCLot *lot = xaccSplitGetLot(s);
+                            if (lot &&
+                                (gncInvoiceGetInvoiceFromLot (lot) ||
+                                gncOwnerGetOwnerFromLot (lot, &owner)))
+                                apar_splits = g_list_prepend (apar_splits, s);
+                        }
+                    }
+    );
+
+    apar_splits = g_list_reverse (apar_splits);
+    return apar_splits;
+}
+
 Split *xaccTransGetFirstPaymentAcctSplit(const Transaction *trans)
 {
     FOR_EACH_SPLIT (trans,
                     const Account *account = xaccSplitGetAccount(s);
-                    if (gncBusinessIsPaymentAcctType(xaccAccountGetType(account)))
+                    if (account && gncBusinessIsPaymentAcctType(xaccAccountGetType(account)))
                         return s;
                    );
 
     return NULL;
 }
 
-Split *xaccTransGetFirstAPARAcctSplit(const Transaction *trans)
+Split *xaccTransGetFirstAPARAcctSplit (const Transaction *trans, gboolean strict)
 {
     FOR_EACH_SPLIT (trans,
                     const Account *account = xaccSplitGetAccount(s);
-                    if (xaccAccountIsAPARType(xaccAccountGetType(account)))
-                        return s;
+                    if (account && xaccAccountIsAPARType(xaccAccountGetType(account)))
+                    {
+                        GNCLot *lot;
+                        GncOwner owner;
+
+                        if (!strict)
+                            return s;
+
+                        lot = xaccSplitGetLot(s);
+                        if (lot &&
+                            (gncInvoiceGetInvoiceFromLot (lot) ||
+                            gncOwnerGetOwnerFromLot (lot, &owner)))
+                            return s;
+                    }
                    );
 
     return NULL;
diff --git a/libgnucash/engine/Transaction.h b/libgnucash/engine/Transaction.h
index a56a2c6..a196e89 100644
--- a/libgnucash/engine/Transaction.h
+++ b/libgnucash/engine/Transaction.h
@@ -370,10 +370,27 @@ int xaccTransGetSplitIndex(const Transaction *trans, const Split *split);
 
 /** The xaccTransGetSplitList() method returns a GList of the splits
     in a transaction.
+    @param trans The transaction
     @return The list of splits. This list must NOT be modified.  Do *NOT* free
     this list when you are done with it. */
 /*@ dependent @*/
 SplitList *   xaccTransGetSplitList (const Transaction *trans);
+
+/** The xaccTransGetPaymentAcctSplitList() method returns a GList of the splits
+    in a transaction that belong to an account which is considered a
+    valid account for business payments.
+    @param trans The transaction
+    @return The list of splits. This list must be freed when you are done with it. */
+SplitList *   xaccTransGetPaymentAcctSplitList (const Transaction *trans);
+
+/** The xaccTransGetAPARSplitList() method returns a GList of the splits
+    in a transaction that belong to an AR or AP account.
+    @param trans The transaction
+    @param strict This slightly modifies the test to only consider splits in an AR or AP account and the split is part of a business lot
+    @return The list of splits. This list must be freed when you are done with it. */
+SplitList *   xaccTransGetAPARAcctSplitList (const Transaction *trans, gboolean strict);
+
+
 gboolean      xaccTransStillHasSplit(const Transaction *trans, const Split *s);
 
 /** The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first
@@ -387,9 +404,10 @@ Split *       xaccTransGetFirstPaymentAcctSplit (const Transaction *trans);
 /** The xaccTransGetFirstPaymentAcctSplit() method returns a pointer to the first
     split in this transaction that belongs to an AR or AP account.
     @param trans The transaction
+    @param strict This slightly modifies the test to only consider splits in an AR or AP account and the split is part of a business lot
 
     If there is no such split in the transaction NULL will be returned. */
-Split *       xaccTransGetFirstAPARAcctSplit (const Transaction *trans);
+Split *       xaccTransGetFirstAPARAcctSplit (const Transaction *trans, gboolean strict);
 
 /** Set the transaction to be ReadOnly by setting a non-NULL value as "reason".
  *
diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index af0faee..1035ef9 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -656,7 +656,7 @@ gboolean gncOwnerGetOwnerFromTxn (Transaction *txn, GncOwner *owner)
     if (xaccTransGetTxnType (txn) == TXN_TYPE_NONE)
         return FALSE;
 
-    apar_split = xaccTransGetFirstAPARAcctSplit (txn);
+    apar_split = xaccTransGetFirstAPARAcctSplit (txn, TRUE);
     if (apar_split)
     {
         GNCLot *lot = xaccSplitGetLot (apar_split);

commit de4414b2a100812aa796041d1a87c99d1aa63418
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Nov 9 20:36:54 2017 +0100

    Inform the user when assign as payment can't be used

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 85300e5..c87e949 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -1210,7 +1210,7 @@ gboolean gnc_ui_payment_is_customer_payment(const Transaction *txn)
 
 // ///////////////
 
-PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
 {
     Split *assetaccount_split;
     Split *postaccount_split;
@@ -1224,9 +1224,19 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn)
 
     if (!xaccTransGetSplitList(txn))
         return NULL;
+
     assetaccount_split = xaccTransGetFirstPaymentAcctSplit(txn);
     if (!assetaccount_split)
     {
+
+        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
+                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                    GTK_MESSAGE_INFO,
+                                                    GTK_BUTTONS_CLOSE,
+                                                    "%s",
+                                                    _("The selected transaction doesn't have splits that can be assigned as a payment"));
+        gtk_dialog_run (GTK_DIALOG(dialog));
+        gtk_widget_destroy (dialog);
         g_message("No asset splits in txn \"%s\"; cannot use this for assigning a payment.",
                   xaccTransGetDescription(txn));
         return NULL;
diff --git a/gnucash/gnome/dialog-payment.h b/gnucash/gnome/dialog-payment.h
index d393b16..49113da 100644
--- a/gnucash/gnome/dialog-payment.h
+++ b/gnucash/gnome/dialog-payment.h
@@ -34,7 +34,7 @@ PaymentWindow * gnc_ui_payment_new (GncOwner *owner, QofBook *book);
 PaymentWindow * gnc_ui_payment_new_with_invoice (const GncOwner *owner,
         QofBook *book,
         GncInvoice *invoice);
-PaymentWindow * gnc_ui_payment_new_with_txn (GncOwner *owner, Transaction *txn);
+PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget *parent, GncOwner *owner, Transaction *txn);
 
 /** Returns TRUE if the given transaction (to be used with gnc_ui_payment_new_with_txn() )
  * is for a customer, or FALSE if it's from a vendor or employee voucher. */
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index a4660c6..32d3132 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -827,7 +827,7 @@ static void gnc_business_assign_payment (GtkWidget *parent,
         return;
 
     //g_message("Creating payment dialog with trans %p", trans);
-    gnc_ui_payment_new_with_txn(owner, trans);
+    gnc_ui_payment_new_with_txn(parent, owner, trans);
 }
 
 static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,

commit 954ce1ab118850ec8d8f844698407b697829359a
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Nov 14 14:00:04 2017 +0100

    Mark unused function parameters as such in dialog-payment.c

diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index aafa4a5..85300e5 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -180,7 +180,7 @@ void gnc_payment_window_fill_docs_list (PaymentWindow *pw);
 
 
 static void
-gnc_payment_window_refresh_handler (GHashTable *changes, gpointer data)
+gnc_payment_window_refresh_handler (G_GNUC_UNUSED GHashTable *changes, gpointer data)
 {
     PaymentWindow *pw = data;
 
@@ -275,7 +275,7 @@ gnc_payment_window_close_handler (gpointer data)
 
 static void
 calculate_selected_total_helper (GtkTreeModel *model,
-                                 GtkTreePath *path,
+                                 G_GNUC_UNUSED GtkTreePath *path,
                                  GtkTreeIter *iter,
                                  gpointer data)
 {
@@ -564,7 +564,7 @@ gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
 }
 
 static int
-gnc_payment_dialog_owner_changed_cb (GtkWidget *widget, gpointer data)
+gnc_payment_dialog_owner_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
     GncOwner owner;
@@ -588,7 +588,7 @@ gnc_payment_dialog_owner_changed_cb (GtkWidget *widget, gpointer data)
 }
 
 void
-gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer data)
+gnc_payment_dialog_document_selection_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
 
@@ -601,7 +601,7 @@ gnc_payment_dialog_document_selection_changed_cb (GtkWidget *widget, gpointer da
 }
 
 void
-gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data)
+gnc_payment_dialog_xfer_acct_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
 
@@ -612,7 +612,7 @@ gnc_payment_dialog_xfer_acct_changed_cb (GtkWidget *widget, gpointer data)
 }
 
 int
-gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data)
+gnc_payment_dialog_post_to_changed_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
     Account *post_acct;
@@ -643,7 +643,7 @@ gnc_payment_dialog_post_to_changed_cb (GtkWidget *widget, gpointer data)
  */
 static void
 get_selected_lots (GtkTreeModel *model,
-                   GtkTreePath *path,
+                   G_GNUC_UNUSED GtkTreePath *path,
                    GtkTreeIter *iter,
                    gpointer data)
 {
@@ -660,7 +660,7 @@ get_selected_lots (GtkTreeModel *model,
 }
 
 void
-gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
+gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
     const char *text = NULL;
@@ -762,14 +762,14 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
 }
 
 void
-gnc_payment_cancel_cb (GtkWidget *widget, gpointer data)
+gnc_payment_cancel_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
     gnc_ui_payment_window_destroy (pw);
 }
 
 void
-gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data)
+gnc_payment_window_destroy_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
 {
     PaymentWindow *pw = data;
 
@@ -784,7 +784,7 @@ 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)
+                                        G_GNUC_UNUSED GtkTreeViewColumn *column, PaymentWindow *pw)
 {
     GtkTreeView *view;
     GtkTreeModel *model;
@@ -813,7 +813,8 @@ gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
 }
 
 void
-gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
+gnc_payment_leave_amount_cb (G_GNUC_UNUSED GtkWidget *widget,
+                             G_GNUC_UNUSED GdkEventFocus *event,
                              PaymentWindow *pw)
 {
     gnc_numeric amount_deb, amount_cred, amount_tot;
@@ -850,18 +851,18 @@ gnc_payment_set_account_types (GncTreeViewAccount *tree)
 }
 
 static gboolean
-find_handler (gpointer find_data, gpointer user_data)
+find_handler (G_GNUC_UNUSED gpointer find_data, gpointer user_data)
 {
     PaymentWindow *pw = user_data;
 
     return (pw != NULL);
 }
 
-static void print_date (GtkTreeViewColumn *tree_column,
+static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
                         GtkCellRenderer *cell,
                         GtkTreeModel *tree_model,
                         GtkTreeIter *iter,
-                        gpointer data)
+                        G_GNUC_UNUSED gpointer data)
 {
     GValue value = { 0 };
     time64 doc_date_time;

commit 61316648b801e4726876e07ef4cf1dda46d488be
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 9 13:00:27 2017 -0800

    Bug 789608 - Compilation problems when linking libraries.
    
    Fix using a preproc macro in a different file from where it was declared
    and more-strict template resolution of error_handler<> by gcc-7.x.

diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index 9ea3723..4e6077e 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -93,7 +93,6 @@ extern "C"
 
 #if LIBDBI_VERSION >= 900
 #define HAVE_LIBDBI_R 1
-#define HAVE_LIBDBI_TO_LONGLONG 1
 static dbi_inst dbi_instance = nullptr;
 #else
 #define HAVE_LIBDBI_R 0
@@ -253,8 +252,8 @@ GncDbiBackend<Type>::set_standard_connection_options (dbi_conn conn,
     return true;
 }
 
-template <DbType Type> void error_handler(void* conn, void* data);
-void error_handler(void* conn, void* data);
+template <DbType Type> void error_handler(dbi_conn conn, void* data);
+void error_handler(dbi_conn conn, void* data);
 
 template <DbType Type> dbi_conn
 GncDbiBackend<Type>::conn_setup (PairVec& options, UriStrings& uri)
diff --git a/libgnucash/backend/dbi/gnc-dbisqlresult.cpp b/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
index 6ceb595..4115a11 100644
--- a/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
+++ b/libgnucash/backend/dbi/gnc-dbisqlresult.cpp
@@ -36,6 +36,12 @@ extern "C"
 
 static QofLogModule log_module = G_LOG_DOMAIN;
 
+#if LIBDBI_VERSION >= 900
+#define HAVE_LIBDBI_TO_LONGLONG 1
+#else
+#define HAVE_LIBDBI_TO_LONGLONG 0
+#endif
+
 GncDbiSqlResult::~GncDbiSqlResult()
 {
     int status = dbi_result_free (m_dbi_result);
@@ -152,17 +158,17 @@ GncDbiSqlResult::IteratorImpl::get_string_at_col(const char* col) const
 time64
 GncDbiSqlResult::IteratorImpl::get_time64_at_col (const char* col) const
 {
-    auto type = dbi_result_get_field_type (m_inst->m_dbi_result, col);
-    auto attrs = dbi_result_get_field_attribs (m_inst->m_dbi_result, col);
+    auto result = (dbi_result_t*) (m_inst->m_dbi_result);
+    auto type = dbi_result_get_field_type (result, col);
+    auto attrs = dbi_result_get_field_attribs (result, col);
     if (type != DBI_TYPE_DATETIME)
         throw (std::invalid_argument{"Requested time64 from non-time64 column."});
     gnc_push_locale (LC_NUMERIC, "C");
 #if HAVE_LIBDBI_TO_LONGLONG
-    /* A less evil hack than the one equrie by libdbi-0.8, but
+    /* A less evil hack than the one required by libdbi-0.8, but
      * still necessary to work around the same bug.
      */
-    auto retval = dbi_result_get_as_longlong(dbi_row->result,
-                                             col_name);
+    auto retval = dbi_result_get_as_longlong(result, col);
 #else
     /* A seriously evil hack to work around libdbi bug #15
      * https://sourceforge.net/p/libdbi/bugs/15/. When libdbi
@@ -170,7 +176,6 @@ GncDbiSqlResult::IteratorImpl::get_time64_at_col (const char* col) const
      * dbi_result_get_as_longlong.
      * Note: 0.9 is available in Debian Jessie and Fedora 21.
      */
-    auto result = (dbi_result_t*) (m_inst->m_dbi_result);
     auto row = dbi_result_get_currow (result);
     auto idx = dbi_result_get_field_idx (result, col) - 1;
     time64 retval = result->rows[row]->field_values[idx].d_datetime;

commit 1895ae280c08eb6f750ceb546ad2af78c7a78bca
Merge: f888eb8 45bab93
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 9 13:43:32 2017 -0800

    Merge branch 'maint' into unstable

diff --cc gnucash/gnome-search/dialog-search.c
index 2eb6284,0000000..badc97d
mode 100644,000000..100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@@ -1,1501 -1,0 +1,1502 @@@
 +/*
 + * dialog-search.c -- Search Dialog
 + * Copyright (C) 2002 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-util.h"
 +#include "gnc-ui.h"
 +#include "gnc-gui-query.h"
 +#include "gnc-query-view.h"
 +#include "gnc-prefs.h"
 +#include "gnc-session.h"
 +#include "qof.h"
 +#include "engine-helpers.h"
 +#include "qofbookslots.h"
 +
 +#include "Transaction.h"	/* for the SPLIT_* and TRANS_* */
 +
 +#include "dialog-search.h"
 +#include "search-core-type.h"
 +#include "search-param.h"
 +
 +/* This static indicates the debugging module that this .o belongs to.  */
 +static QofLogModule log_module = G_LOG_DOMAIN;
 +
 +#define DIALOG_SEARCH_CM_CLASS "dialog-search"
 +#define GNC_PREFS_GROUP_SEARCH_GENERAL "dialogs.search"
 +#define GNC_PREF_NEW_SEARCH_LIMIT  "new-search-limit"
 +#define GNC_PREF_ACTIVE_ONLY       "search-for-active-only"
 +
 +typedef enum
 +{
 +    GNC_SEARCH_MATCH_ALL = 0,
 +    GNC_SEARCH_MATCH_ANY = 1
 +} GNCSearchType;
 +
 +enum search_cols
 +{
 +    SEARCH_COL_NAME = 0,
 +    SEARCH_COL_POINTER,
 +    NUM_SEARCH_COLS
 +};
 +
 +struct _GNCSearchWindow
 +{
 +    GtkWidget               *dialog;
 +    GtkWidget               *grouping_combo;
 +    GtkWidget               *match_all_label;
 +    GtkWidget               *criteria_table;
 +    GtkWidget               *result_hbox;
 +
 +    /* The "results" sub-window widgets */
 +    GtkWidget               *result_view;
 +    gpointer                 selected_item;
 +    GList                   *selected_item_list;
 +
 +    /* The search_type radio-buttons */
 +    GtkWidget               *new_rb;
 +    GtkWidget               *narrow_rb;
 +    GtkWidget               *add_rb;
 +    GtkWidget               *del_rb;
 +    GtkWidget               *active_only_check;
 +
 +    /* The Select button */
 +    GtkWidget               *select_button;
 +    GList                   *button_list;
 +
 +    /* The close/cancel buttons */
 +    GtkWidget               *close_button;
 +    GtkWidget               *cancel_button;
 +
 +    /* Callbacks */
 +    GNCSearchResultCB        result_cb;
 +    GNCSearchNewItemCB       new_item_cb;
 +    GNCSearchCallbackButton *buttons;
 +    GNCSearchFree            free_cb;
 +    gpointer                 user_data;
 +
 +    GNCSearchSelectedCB      selected_cb;
 +    gpointer                 select_arg;
 +    gboolean                 allow_clear;
 +
 +    /* What we're searching for, and how */
 +    const gchar              *type_label;
 +    QofIdTypeConst            search_for;
 +    GNCSearchType             grouping;     /* Match Any, Match All */
 +    const QofParam           *get_guid;     /* Function to GetGUID from the object */
 +    int                       search_type;  /* New, Narrow, Add, Delete */
 +
 +    /* Our query status */
 +    QofQuery                 *q;
 +    QofQuery                 *start_q;      /* The query to start from, if any */
 +
 +    /* The list of criteria */
 +    GNCSearchParam           *last_param;
 +    GList                    *params_list;  /* List of GNCSearchParams */
 +    GList                    *display_list; /* List of GNCSearchParamSimples for Display */
 +    gint                      num_cols;     /* Number of Display Columns */
 +    GList                    *crit_list;    /* List of crit_data */
 +
 +    gint                      component_id;
 +    const gchar              *prefs_group;
 +};
 +
 +struct _crit_data
 +{
 +    GNCSearchParam    *param;
 +    GNCSearchCoreType *element;
 +    GtkWidget         *elemwidget;
 +    GtkWidget         *container;
 +    GtkWidget         *button;
 +    GtkDialog         *dialog;
 +};
 +
 +static void search_clear_criteria (GNCSearchWindow *sw);
 +static void gnc_search_dialog_display_results (GNCSearchWindow *sw);
 +
 +static void
 +gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
 +                                    GNCSearchWindow *sw)
 +{
 +    GNCQueryView     *qview = GNC_QUERY_VIEW(sw->result_view);
 +    GtkTreeSelection *selection;
 +
 +    // Sanity check
 +    g_assert(qview);
 +    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(qview));
 +    g_assert(gtk_tree_selection_get_mode(selection) == GTK_SELECTION_MULTIPLE);
 +    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(qview));
 +
 +    /* Do we have a callback for multi-selections ? */
 +    if (cb->cb_multiselect_fn && (!cb->cb_fcn ))
 +    {
 +        /* We have allready populated the selected_item_list from the select row callback */
 +        // We use g_list_prepend (for performance reasons), so we have to reverse once here
 +        sw->selected_item_list = g_list_reverse(sw->selected_item_list);
 +
 +        // Call the callback
 +        (cb->cb_multiselect_fn)(sw->selected_item_list, sw->user_data);
 +    }
 +    else
 +    {
 +        // No, stick to the single-item callback
 +        if (cb->cb_fcn)
 +            (cb->cb_fcn)(&(sw->selected_item), sw->user_data);
 +    }
 +}
 +
 +
 +static void
 +gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    GNCSearchCallbackButton *cb;
 +
 +    cb = g_object_get_data (G_OBJECT (button), "data");
 +    gnc_search_callback_button_execute (cb, sw);
 +}
 +
 +
 +static void
 +gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected)
 +{
 +    gboolean enable, read_only;
 +    GList  *blist;
 +
 +    read_only = qof_book_is_readonly (gnc_get_current_book ());
 +
 +    for (blist = sw->button_list; blist; blist = blist->next)
 +    {
 +        GNCSearchCallbackButton  *button_spec = g_object_get_data (G_OBJECT(blist->data) , "data");
 +
 +        if(selected == 0)
 +        {
 +            gtk_widget_set_sensitive (GTK_WIDGET(blist->data), FALSE);
 +            continue;
 +        }
 +
 +        if(read_only == TRUE)
 +        {
 +            if((selected > 1) && (!(button_spec->cb_multiselect_fn == NULL)) && (button_spec->sensitive_if_readonly == TRUE))
 +                enable = TRUE;
 +            else
 +                enable = FALSE;
 +
 +            if((selected == 1) && (button_spec->sensitive_if_readonly == TRUE))
 +                enable = TRUE;
 +        }
 +        else
 +        {
 +            if((selected > 1) && (!(button_spec->cb_multiselect_fn == NULL)))
 +                enable = TRUE;
 +            else
 +                enable = FALSE;
 +
 +            if(selected == 1)
 +                enable = TRUE;
 +        }
 +        gtk_widget_set_sensitive (GTK_WIDGET(blist->data), enable);
 +    }
 +}
 +
 +
 +static void
 +gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    g_return_if_fail (sw->selected_cb);
 +
 +    if (sw->selected_item == NULL && sw->allow_clear == FALSE)
 +    {
 +        char *msg = _("You must select an item from the list");
 +        gnc_error_dialog (sw->dialog, "%s", msg);
 +        return;
 +    }
 +
 +    (sw->selected_cb)(sw->selected_item, sw->select_arg);
 +    gnc_search_dialog_destroy (sw);
 +}
 +
 +
 +static void
 +gnc_search_dialog_select_row_cb (GNCQueryView *qview,
 +                                 gpointer item,
 +                                 gpointer user_data)
 +{
 +    GNCSearchWindow  *sw = user_data;
 +    gint              number_of_rows;
 +
 +    sw->selected_item_list = NULL;
 +    sw->selected_item = NULL;
 +
 +    number_of_rows = GPOINTER_TO_INT(item);
 +
 +    gnc_search_dialog_select_buttons_enable(sw, number_of_rows);
 +
 +    if(number_of_rows == 1)
 +    {
 +        sw->selected_item = qview->selected_entry;
 +        sw->selected_item_list = qview->selected_entry_list;
 +    }
 +    else
 +        sw->selected_item_list = qview->selected_entry_list;
 +}
 +
 +
 +static void
 +gnc_search_dialog_double_click_cb (GNCQueryView *qview,
 +                                   gpointer item,
 +                                   gpointer user_data)
 +{
 +    GNCSearchWindow  *sw = user_data;
 +
 +    sw->selected_item = item;
 +    if (sw->selected_cb)
 +        /* Select the item */
 +        gnc_search_dialog_select_cb (NULL, sw);
 +    else if (sw->buttons)
 +        /* Call the first button (usually view/edit) */
 +        gnc_search_callback_button_execute (sw->buttons, sw);
 +
 +    /* If we get here, then nothing to do for a double-click */
 +}
 +
 +
 +static void
 +gnc_search_dialog_init_result_view (GNCSearchWindow *sw)
 +{
 +    GtkTreeSelection *selection;
 +
 +    sw->result_view = gnc_query_view_new(sw->display_list, sw->q);
 +
 +    // We want the multi-selection mode of the tree view.
 +    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(sw->result_view));
 +    gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
 +
 +    /* Set the sort order of the tree view */
 +    gnc_query_sort_order(GNC_QUERY_VIEW(sw->result_view), 1, GTK_SORT_ASCENDING);
 +
 +    /* Setup the list callbacks */
 +    g_signal_connect (GNC_QUERY_VIEW(sw->result_view), "row_selected",
 +                      G_CALLBACK (gnc_search_dialog_select_row_cb), sw);
 +
 +    g_signal_connect (GNC_QUERY_VIEW(sw->result_view), "double_click_entry",
 +                      G_CALLBACK(gnc_search_dialog_double_click_cb), sw);
 +}
 +
 +
 +static void
 +gnc_search_dialog_display_results (GNCSearchWindow *sw)
 +{
 +    gdouble max_count;
 +
 +    /* Check if this is the first time this is called for this window.
 +     * If so, then build the results sub-window, the scrolled treeview,
 +     * and the active buttons.
 +     */
 +    if (sw->result_view == NULL)
 +    {
 +        GtkWidget *scroller, *frame, *button_box, *button;
 +
 +        /* Create the view */
 +        gnc_search_dialog_init_result_view (sw);
 +
 +        frame = gtk_frame_new(NULL);
 +
 +        /* Create the scroller and add the view to the scroller */
 +        scroller = gtk_scrolled_window_new (NULL, NULL);
 +        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
 +                                        GTK_POLICY_AUTOMATIC,
 +                                        GTK_POLICY_AUTOMATIC);
 +        gtk_widget_set_size_request(GTK_WIDGET(scroller), 300, 100);
 +        gtk_container_add (GTK_CONTAINER (scroller), sw->result_view);
 +        gtk_container_add(GTK_CONTAINER(frame), scroller);
 +
 +        /* Create the button_box */
 +        button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
 +        gtk_box_set_homogeneous (GTK_BOX (button_box), FALSE);
 +
 +        /* ... and add all the buttons */
 +        if (sw->buttons)
 +        {
 +            int i;
 +
 +            button = gtk_button_new_with_label (_("Select"));
 +            g_signal_connect (G_OBJECT (button), "clicked",
 +                              G_CALLBACK (gnc_search_dialog_select_cb), sw);
 +            gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 3);
 +            sw->select_button = button;
 +
 +            for (i = 0; sw->buttons[i].label; i++)
 +            {
 +                GNCSearchCallbackButton* button_spec = sw->buttons + i;
 +                button = gtk_button_new_with_label (_(button_spec->label));
 +                g_object_set_data (G_OBJECT (button), "data", button_spec);
 +
 +                if (qof_book_is_readonly (gnc_get_current_book ()))
 +                    gtk_widget_set_sensitive (GTK_WIDGET(button), button_spec->sensitive_if_readonly);
 +
 +                /* Save the button pointer */
 +                sw->button_list = g_list_append(sw->button_list, button);
 +
 +                g_signal_connect (G_OBJECT (button), "clicked",
 +                                  G_CALLBACK (gnc_search_dialog_result_clicked), sw);
 +                gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 3);
 +            }
 +        }
 +
 +        /* Add the scrolled-view and button-box to the results_box */
 +        gtk_box_pack_end (GTK_BOX (sw->result_hbox), button_box, FALSE, FALSE, 3);
 +        gtk_box_pack_end (GTK_BOX (sw->result_hbox), frame, TRUE, TRUE, 3);
 +
 +        /* And show the results */
 +        gtk_widget_show_all (sw->result_hbox);
 +
 +        /* But may be hide the select button */
 +        if (!sw->selected_cb)
 +            gtk_widget_hide (sw->select_button);
 +    }
 +    else
 +        /* Update the query in the view */
 +        gnc_query_view_reset_query (GNC_QUERY_VIEW(sw->result_view), sw->q);
 +
 +    /* Deselect all the select buttons and any items */
 +    gnc_search_dialog_select_buttons_enable (sw, 0);
 +    gnc_query_view_unselect_all (GNC_QUERY_VIEW(sw->result_view));
 +
 +    /* set 'new search' if fewer than max_count items is returned. */
 +    max_count = gnc_prefs_get_float(GNC_PREFS_GROUP_SEARCH_GENERAL, GNC_PREF_NEW_SEARCH_LIMIT);
 +    if (gnc_query_view_get_num_entries(GNC_QUERY_VIEW(sw->result_view)) < max_count)
 +        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), TRUE);
 +}
 +
 +
 +static void
 +match_combo_changed (GtkComboBoxText *combo_box, GNCSearchWindow *sw)
 +{
 +    sw->grouping = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
 +}
 +
 +
 +static void
 +search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
 +{
 +    GSList * buttongroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON(button));
 +
 +    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
 +    {
 +        sw->search_type =
 +            g_slist_length (buttongroup) - g_slist_index (buttongroup, button) - 1;
 +    }
 +}
 +
 +
 +static void
 +search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw)
 +{
 +
 +    gnc_prefs_set_bool(sw->prefs_group, GNC_PREF_ACTIVE_ONLY,
 +                       gtk_toggle_button_get_active (button));
 +}
 +
 +static QofQuery *
 +create_query_fragment (QofIdTypeConst search_for, GNCSearchParam *param, QofQueryPredData *pdata)
 +{
 +    GNCSearchParamKind kind = gnc_search_param_get_kind (param);
 +    QofQuery *q = qof_query_create_for (search_for);
 +    
 +    if (kind == SEARCH_PARAM_ELEM)
 +    {
 +        /* The "op" parameter below will be ignored since q has no terms. */
 +        qof_query_add_term (q, gnc_search_param_get_param_path (GNC_SEARCH_PARAM_SIMPLE (param)),
 +                            pdata, QOF_QUERY_OR);
 +    } 
 +    else
 +    {
 +        GList *plist = gnc_search_param_get_search (GNC_SEARCH_PARAM_COMPOUND (param));
 +        
 +        for ( ; plist; plist  = plist->next)
 +        {
 +            QofQuery *new_q;
 +            GNCSearchParam *param2 = plist->data;
 +            QofQuery *q2 = create_query_fragment (search_for, param2, 
 +                                                  qof_query_core_predicate_copy (pdata));
 +            new_q = qof_query_merge (q, q2, kind == SEARCH_PARAM_ANY ? 
 +                                                    QOF_QUERY_OR : QOF_QUERY_AND);
 +            qof_query_destroy (q);
 +            qof_query_destroy (q2);
 +            q = new_q;
 +        }
 +        qof_query_core_predicate_free (pdata);
 +    }
 +    return q;
 +}
 +
 +static void
 +search_update_query (GNCSearchWindow *sw)
 +{
 +    static GSList *active_params = NULL;
 +    QofQuery *q, *q2, *new_q;
 +    GList *node;
 +    QofQueryOp op;
 +
 +    if (sw->grouping == GNC_SEARCH_MATCH_ANY)
 +        op = QOF_QUERY_OR;
 +    else
 +        op = QOF_QUERY_AND;
 +
 +    if (active_params == NULL)
 +        active_params = g_slist_prepend (NULL, QOF_PARAM_ACTIVE);
 +
 +    /* Make sure we supply a book! */
 +    if (sw->start_q == NULL)
 +    {
 +        sw->start_q = qof_query_create_for (sw->search_for);
 +        qof_query_set_book (sw->start_q, gnc_get_current_book ());
 +    }
 +    else
 +    {
 +        /* We've got a query -- purge it of any "active" parameters */
 +        qof_query_purge_terms (sw->start_q, active_params);
 +    }
 +
 +    /* Now create a new query to work from */
 +    q = qof_query_create_for (sw->search_for);
 +
 +    /* Walk the list of criteria */
 +    for (node = sw->crit_list; node; node = node->next)
 +    {
 +        struct _crit_data *data = node->data;
 +        QofQueryPredData* pdata;
 +
 +        pdata = gnc_search_core_type_get_predicate (data->element);
 +        if (pdata)
 +        {
 +            q2 = create_query_fragment(sw->search_for, GNC_SEARCH_PARAM (data->param), pdata);
 +            q = qof_query_merge (q, q2, op);
 +        }
 +    }
 +
 +    /* Now combine this query with the existing query, depending on
 +     * what we want to do...  We can assume that cases 1, 2, and 3
 +     * already have sw->q being valid!
 +     */
 +
 +    switch (sw->search_type)
 +    {
 +    case 0:			/* New */
 +        new_q = qof_query_merge (sw->start_q, q, QOF_QUERY_AND);
 +        qof_query_destroy (q);
 +        break;
 +    case 1:			/* Refine */
 +        new_q = qof_query_merge (sw->q, q, QOF_QUERY_AND);
 +        qof_query_destroy (q);
 +        break;
 +    case 2:			/* Add */
 +        new_q = qof_query_merge (sw->q, q, QOF_QUERY_OR);
 +        qof_query_destroy (q);
 +        break;
 +    case 3:			/* Delete */
 +        q2 = qof_query_invert (q);
 +        new_q = qof_query_merge (sw->q, q2, QOF_QUERY_AND);
 +        qof_query_destroy (q2);
 +        qof_query_destroy (q);
 +        break;
 +    default:
 +        g_warning ("bad search type: %d", sw->search_type);
 +        new_q = q;
 +        break;
 +    }
 +
 +    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sw->active_only_check)))
 +    {
 +        qof_query_add_boolean_match (new_q, active_params, TRUE, QOF_QUERY_AND);
 +        active_params = NULL;
 +    }
 +
 +    /* Destroy the old query */
 +    if (sw->q)
 +        qof_query_destroy (sw->q);
 +
 +    /* And save the new one */
 +    sw->q = new_q;
 +}
 +
 +
 +static void
 +gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
 +{
 +    if (sw->selected_cb)
 +    {
 +        gtk_widget_show (sw->cancel_button);
 +        gtk_widget_hide (sw->close_button);
 +    }
 +    else
 +    {
 +        gtk_widget_hide (sw->cancel_button);
 +        gtk_widget_show (sw->close_button);
 +    }
 +}
 +
 +
 +static void
 +gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
 +{
 +    gboolean sens = (sw->q != NULL);
 +
 +    gtk_widget_set_sensitive(GTK_WIDGET(sw->narrow_rb), sens);
 +    gtk_widget_set_sensitive(GTK_WIDGET(sw->add_rb), sens);
 +    gtk_widget_set_sensitive(GTK_WIDGET(sw->del_rb), sens);
 +
 +    if (sw->q)
 +    {
 +        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), FALSE);
 +        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->narrow_rb), TRUE);
 +    }
 +
 +    if (sw->crit_list)
 +    {
 +        gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
 +        gtk_widget_hide(sw->match_all_label);
 +    }
 +    else
 +    {
 +        gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
 +        gtk_widget_show(sw->match_all_label);
 +    }
 +}
 +
 +
 +static gboolean
 +gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
 +{
 +    struct _crit_data *data;
 +    GList *l;
 +    gboolean ret;
 +
 +    if (!sw->crit_list)
 +        return TRUE;
 +
 +    l = g_list_last (sw->crit_list);
 +    data = l->data;
 +    ret = gnc_search_core_type_validate (data->element);
 +
 +    if (ret)
 +        sw->last_param = data->param;
 +
 +    return ret;
 +}
 +
 +
 +static void
 +search_find_cb (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    if (!gnc_search_dialog_crit_ok (sw))
 +        return;
 +
 +    search_update_query (sw);
 +    search_clear_criteria (sw);
 +    gnc_search_dialog_reset_widgets (sw);
 +
 +    if (sw->result_cb)
 +        (sw->result_cb)(sw->q, sw->user_data, &(sw->selected_item));
 +    else
 +        gnc_search_dialog_display_results (sw);
 +}
 +
 +
 +static void
 +search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    gpointer res;
 +
 +    g_return_if_fail (sw->new_item_cb);
 +
 +    res = (sw->new_item_cb)(sw->user_data);
 +
 +    if (res)
 +    {
 +        const GncGUID *guid = (const GncGUID *) ((sw->get_guid->param_getfcn)(res, sw->get_guid));
 +        QofQueryOp op = QOF_QUERY_OR;
 +
 +        if (!sw->q)
 +        {
 +            if (!sw->start_q)
 +            {
 +                sw->start_q = qof_query_create_for (sw->search_for);
 +                qof_query_set_book (sw->start_q, gnc_get_current_book ());
 +            }
 +            sw->q = qof_query_copy (sw->start_q);
 +            op = QOF_QUERY_AND;
 +        }
 +
 +        qof_query_add_guid_match (sw->q, g_slist_prepend (NULL, QOF_PARAM_GUID),
 +                                  guid, op);
 +
 +        /* Watch this entity so we'll refresh once it's actually changed */
 +        gnc_gui_component_watch_entity (sw->component_id, guid, QOF_EVENT_MODIFY);
 +    }
 +}
 +
 +
 +static void
 +search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    /* Don't select anything */
 +    sw->selected_item = NULL;
 +    gnc_search_dialog_destroy (sw);
 +}
 +
 +
 +static void
 +search_help_cb (GtkButton *button, GNCSearchWindow *sw)
 +{
 +    gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS);
 +}
 +
 +
 +static void
 +remove_element (GtkWidget *button, GNCSearchWindow *sw)
 +{
 +    GtkWidget *element;
 +    struct _elem_data *data;
 +
 +    if (!sw->crit_list)
 +        return;
 +
 +    element = g_object_get_data (G_OBJECT (button), "element");
 +    data = g_object_get_data (G_OBJECT (element), "data");
 +
 +    /* remove the element from the list */
 +    sw->crit_list = g_list_remove (sw->crit_list, data);
 +
 +    /* and from the display */
 +    gtk_container_remove (GTK_CONTAINER (sw->criteria_table), element);
 +    gtk_container_remove (GTK_CONTAINER (sw->criteria_table), button);
 +
 +    /* disable match-type menu when there is no criterion */
 +    if (!sw->crit_list)
 +    {
 +        gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
 +        gtk_widget_show(sw->match_all_label);
 +    }
 +}
 +
 +
 +static void
 +attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
 +{
 +    GtkWidget *remove;
 +    struct _crit_data *data;
 +
 +    data = g_object_get_data (G_OBJECT (element), "data");
 +
 +    gtk_grid_attach (GTK_GRID (sw->criteria_table), element, 0, row, 1, 1);
 +    gtk_widget_set_hexpand (element, TRUE);
 +    gtk_widget_set_halign (element, GTK_ALIGN_FILL);
 +    g_object_set (element, "margin", 0, NULL);
 +
 +    remove = gtk_button_new_with_mnemonic (_("_Remove"));
 +    g_object_set_data (G_OBJECT (remove), "element", element);
 +    g_signal_connect (G_OBJECT (remove), "clicked", G_CALLBACK (remove_element), sw);
 +
 +    gtk_grid_attach (GTK_GRID (sw->criteria_table), remove, 1, row, 1, 1);
 +    gtk_widget_set_hexpand (remove, FALSE);
 +    gtk_widget_set_halign (remove, GTK_ALIGN_CENTER);
 +    g_object_set (remove, "margin", 0, NULL);
 +
 +    gtk_widget_show (remove);
 +    data->button = remove;	/* Save the button for later */
 +}
 +
 +
 +static void
 +combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
 +{
 +    GNCSearchParam *param;
 +    GNCSearchCoreType *newelem;
 +    GtkTreeModel *model;
 +    GtkTreeIter iter;
 +
 +    if (!gtk_combo_box_get_active_iter(combo_box, &iter))
 +        return;
 +    model = gtk_combo_box_get_model(combo_box);
 +    gtk_tree_model_get(model, &iter, SEARCH_COL_POINTER, &param, -1);
 +
 +    if (gnc_search_param_type_match (param, data->param))
 +    {
 +        /* The param type is the same, just save the new param */
 +        data->param = param;
 +        return;
 +    }
 +    data->param = param;
 +
 +    /* OK, let's do a widget shuffle, throw away the old widget/element,
 +     * and create another one here.  No need to change the crit_list --
 +     * the pointer to data stays the same.
 +     */
 +    if (data->elemwidget)
 +        gtk_container_remove (GTK_CONTAINER (data->container), data->elemwidget);
 +    g_object_unref (G_OBJECT (data->element));
 +
 +    newelem = gnc_search_core_type_new_type_name
 +              (gnc_search_param_get_param_type (param));
 +    data->element = newelem;
 +    data->elemwidget = gnc_search_core_type_get_widget (newelem);
 +    if (data->elemwidget)
 +    {
 +        gtk_box_pack_start (GTK_BOX (data->container), data->elemwidget,
 +                            FALSE, FALSE, 0);
 +    }
 +
 +    /* Make sure it's visible */
 +    gtk_widget_show_all (data->container);
 +
 +    /* Make sure we widen up if necessary */
 +    gtk_widget_queue_resize (GTK_WIDGET (data->dialog));
 +
 +    /* And grab focus */
 +    gnc_search_core_type_grab_focus (newelem);
 +    gnc_search_core_type_editable_enters (newelem);
 +}
 +
 +
 +static void
 +search_clear_criteria (GNCSearchWindow *sw)
 +{
 +    GList *node;
 +
 +    for (node = sw->crit_list; node; )
 +    {
 +        GList *tmp = node->next;
 +        struct _crit_data *data = node->data;
 +        g_object_ref (data->button);
 +        remove_element (data->button, sw);
 +        node = tmp;
 +    }
 +}
 +
 +
 +static GtkWidget *
 +get_comb_box_widget (GNCSearchWindow *sw, struct _crit_data *data)
 +{
 +    GtkWidget *combo_box;
 +    GtkListStore *store;
 +    GtkTreeIter iter;
 +    GtkCellRenderer *cell;
 +    GList *l;
 +    int index = 0, current = 0;
 +
 +    store = gtk_list_store_new(NUM_SEARCH_COLS, G_TYPE_STRING, G_TYPE_POINTER);
 +    combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
 +    g_object_unref(store);
 +
 +    cell = gtk_cell_renderer_text_new ();
 +    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell, TRUE);
 +    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
 +                                    "text", SEARCH_COL_NAME,
 +                                    NULL);
 +
 +    for (l = sw->params_list; l; l = l->next)
 +    {
 +        GNCSearchParam *param = l->data;
 +
 +        gtk_list_store_append(store, &iter);
 +        gtk_list_store_set(store, &iter,
 +                           SEARCH_COL_NAME, _(param->title),
 +                           SEARCH_COL_POINTER, param,
 +                           -1);
 +
 +        if (param == sw->last_param) /* is this the right parameter to start? */
 +            current = index;
 +
 +        index++;
 +    }
 +
 +    gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box), current);
 +    g_signal_connect (combo_box, "changed", G_CALLBACK (combo_box_changed), data);
 +
 +    return combo_box;
 +}
 +
 +static GtkWidget *
 +get_element_widget (GNCSearchWindow *sw, GNCSearchCoreType *element)
 +{
 +    GtkWidget *combo_box, *hbox, *p;
 +    struct _crit_data *data;
 +
 +    data = g_new0 (struct _crit_data, 1);
 +    data->element = element;
 +    data->dialog = GTK_DIALOG (sw->dialog);
 +
 +    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 +    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
 +
 +    /* only set to automatically clean up the memory */
 +    g_object_set_data_full (G_OBJECT (hbox), "data", data, g_free);
 +
 +    p = gnc_search_core_type_get_widget (element);
 +    data->elemwidget = p;
 +    data->container = hbox;
 +    data->param = sw->last_param;
 +
 +    combo_box = get_comb_box_widget (sw, data);
 +    gtk_box_pack_start (GTK_BOX (hbox), combo_box, FALSE, FALSE, 0);
 +    if (p)
 +        gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
 +    gtk_widget_show_all (hbox);
 +
 +    return hbox;
 +}
 +
 +static void
 +gnc_search_dialog_book_option_changed (gpointer new_val, gpointer user_data)
 +{
 +    GList *l;
 +    GNCSearchWindow *sw = user_data;
 +    gboolean *new_data = (gboolean*)new_val;
 +    /* Save current dialog focus */
 +    GtkWidget *focused_widget = gtk_window_get_focus(GTK_WINDOW(sw->dialog));
 +
 +    g_return_if_fail (sw);
 +    if (strcmp (sw->search_for, GNC_ID_SPLIT) != 0)
 +        return;
 +
 +    /* Adjust labels for future added search criteria */
 +    for (l = sw->params_list; l; l = l->next)
 +    {
 +        GNCSearchParam *param = l->data;
 +
 +        if (*new_data)
 +        {
 +            if (strcmp (param->title, N_("Action")) == 0)
 +                gnc_search_param_set_title (param, N_("Number/Action"));
 +            if (strcmp (param->title, N_("Number")) == 0)
 +                gnc_search_param_set_title (param, N_("Transaction Number"));
 +        }
 +        else
 +        {
 +            if (strcmp (param->title, N_("Number/Action")) == 0)
 +                gnc_search_param_set_title (param, N_("Action"));
 +            if (strcmp (param->title, N_("Transaction Number")) == 0)
 +                gnc_search_param_set_title (param, N_("Number"));
 +        }
 +    }
 +    /* Adjust labels for existing search criteria; walk the list of criteria */
 +    for (l = sw->crit_list; l; l = l->next)
 +    {
 +        struct _crit_data *data = l->data;
 +        GList *children;
 +
 +        /* For each, walk the list of container children to get combo_box */
 +        for (children = gtk_container_get_children(GTK_CONTAINER(data->container));
 +                children; children = children->next)
 +        {
 +            GtkWidget *combo_box = children->data;
 +
 +            /* Get current active item if combo_box */
 +            if (GTK_IS_COMBO_BOX(combo_box))
 +            {
 +                GtkWidget *new_combo_box;
 +                gint index;
 +
 +                /* Set index to current active item */
 +                index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
 +                /* Create new combo_box to replace existing one */
 +                new_combo_box = get_comb_box_widget (sw, data);
 +                /* If current combo_box has focus, point to new_combo-box */
 +                if (focused_widget == combo_box)
 +                    focused_widget = new_combo_box;
 +                gtk_widget_destroy(combo_box);
 +                /* Set new combo_box to current active item */
 +                gtk_combo_box_set_active(GTK_COMBO_BOX(new_combo_box), index);
 +                gtk_box_pack_start (GTK_BOX (data->container), new_combo_box,
 +                                                               FALSE, FALSE, 0);
 +                gtk_box_reorder_child(GTK_BOX (data->container), new_combo_box, 0);
 +                gtk_widget_show_all (data->container);
 +            }
 +        }
 +    }
 +    gtk_widget_grab_focus(focused_widget);
 +}
 +
 +struct grid_size
 +{
 +    /** The grid being sized. */
 +    GtkGrid *grid;
 +    /** The number of columns and rows in the grid. */
 +    gint cols, rows;
 +};
 +
 +static void
 +get_grid_size (GtkWidget *child, gpointer data)
 +{
 +    struct grid_size *gridsize = data;
 +    gint top, left, height, width;
 +
 +    gtk_container_child_get(GTK_CONTAINER(gridsize->grid), child,
 +                            "left-attach", &left,
 +                            "top-attach", &top,
 +                            "height", &height,
 +                            "width", &width,
 +                            NULL);
 +
 +    if (left + width >= gridsize->cols)
 +        gridsize->cols = left + width;
 +
 +    if (top + height >= gridsize->rows)
 +        gridsize->rows = top + height;
 +}
 +
 +static void
 +gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
 +{
 +    GNCSearchCoreType *new_sct;
 +    struct grid_size gridsize;
 +
 +    gridsize.cols = 0;
 +    gridsize.rows = 0;
 +
 +    /* First, make sure that the last criterion is ok */
 +    if (sw->crit_list)
 +    {
 +        if (!gnc_search_dialog_crit_ok (sw))
 +            return;
 +    }
 +    else
 +    {
 +        sw->last_param = sw->params_list->data;
 +
 +        /* no match-all situation anymore */
 +        gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
 +        gtk_widget_hide(sw->match_all_label);
 +    }
 +    /* create a new criterion element */
 +    new_sct = gnc_search_core_type_new_type_name
 +          (gnc_search_param_get_param_type (sw->last_param));
 +
 +    if (new_sct)
 +    {
 +        struct _crit_data *data;
 +        GtkWidget *w;
 +
 +        w = get_element_widget (sw, new_sct);
 +        data = g_object_get_data (G_OBJECT (w), "data");
 +        sw->crit_list = g_list_append (sw->crit_list, data);
 +
 +        gridsize.grid = GTK_GRID (sw->criteria_table);
 +        gtk_container_foreach(GTK_CONTAINER(sw->criteria_table), get_grid_size, &gridsize);
 +
 +        attach_element (w, sw, gridsize.rows);
 +
 +        gnc_search_core_type_grab_focus (new_sct);
 +        gnc_search_core_type_editable_enters (new_sct);
 +    }
 +}
 +
 +
 +static void
 +add_criterion (GtkWidget *button, GNCSearchWindow *sw)
 +{
 +    gnc_search_dialog_add_criterion (sw);
 +}
 +
 +
 +static int
 +gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
 +{
 +    g_return_val_if_fail (sw, TRUE);
 +
 +    /* Unregister callback on book option changes originally registered
 +     * if searching for splits */
 +    if (strcmp (sw->search_for, GNC_ID_SPLIT) == 0)
 +        gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
 +                                    gnc_search_dialog_book_option_changed, sw);
 +
 +    gnc_unregister_gui_component (sw->component_id);
 +
 +    /* Clear the crit list */
 +    g_list_free (sw->crit_list);
 +
 +    /* Clear the button list */
 +    g_list_free (sw->button_list);
 +
 +    /* Destroy the queries */
 +    if (sw->q) qof_query_destroy (sw->q);
 +    if (sw->start_q) qof_query_destroy (sw->start_q);
 +
 +    /* Destroy the user_data */
 +    if (sw->free_cb)
 +        (sw->free_cb)(sw->user_data);
 +
 +    /* Destroy and exit */
 +    g_free (sw);
 +    return FALSE;
 +}
 +
 +
 +static void
 +refresh_handler (GHashTable *changes, gpointer data)
 +{
 +    GNCSearchWindow * sw = data;
 +
 +    g_return_if_fail (sw);
 +    /* This assumes that results_cb will refresh itself which is the case with
 +     * registers. Also, only refresh if you are already displaying results */
 +    if (!sw->result_cb && (sw->result_view != NULL))
 +       gnc_search_dialog_display_results (sw);
 +}
 +
 +
 +static void
 +close_handler (gpointer data)
 +{
 +    GNCSearchWindow * sw = data;
 +
 +    g_return_if_fail (sw);
 +    gtk_widget_destroy (sw->dialog);
 +    /* DRH: should sw be freed here? */
 +}
 +
 +
 +static const gchar *
 +type_label_to_new_button(const gchar* type_label)
 +{
 +    if (g_strcmp0(type_label, _("Bill")) == 0)
 +    {
 +        return _("New Bill");
 +    }
 +    else if (g_strcmp0(type_label, _("Customer")) == 0)
 +    {
 +        return _("New Customer");
 +    }
 +    else if (g_strcmp0(type_label, _("Employee")) == 0)
 +    {
 +        return _("New Employee");
 +    }
 +    else if (g_strcmp0(type_label, _("Expense Voucher")) == 0)
 +    {
 +        return _("New Expense Voucher");
 +    }
 +    else if (g_strcmp0(type_label, _("Invoice")) == 0)
 +    {
 +        return _("New Invoice");
 +    }
 +    else if (g_strcmp0(type_label, _("Job")) == 0)
 +    {
 +        return _("New Job");
 +    }
 +    else if (g_strcmp0(type_label, _("Order")) == 0)
 +    {
 +        return _("New Order");
 +    }
 +    else if (g_strcmp0(type_label, _("Transaction")) == 0)
 +    {
 +        return _("New Transaction");
 +    }
 +    else if (g_strcmp0(type_label, _("Split")) == 0)
 +    {
 +        return _("New Split");
 +    }
 +    else if (g_strcmp0(type_label, _("Vendor")) == 0)
 +    {
 +        return _("New Vendor");
 +    }
 +    else
 +    {
 +        PWARN("No translatable new-button label found for search type \"%s\", please add one into dialog-search.c!", type_label);
++        /* Translators: This string has a disambiguation prefix. Translate only the part behind '|' */
 +        return Q_("Item represents an unknown object type (in the sense of bill, customer, invoice, transaction, split,...)|New item");
 +    }
 +}
 +
 +
 +static void
 +gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
 +{
 +    GtkBuilder        *builder;
 +    GtkWidget         *label, *add, *box;
 +    GtkComboBoxText   *combo_box;
 +    GtkWidget         *widget;
 +    GtkWidget         *new_item_button;
 +    const char        *type_label;
 +    gboolean           active;
 +
 +    builder = gtk_builder_new();
 +    gnc_builder_add_from_file (builder, "dialog-search.glade", "search_dialog");
 +
 +    /* Grab the dialog, save the dialog info */
 +    sw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "search_dialog"));
 +    gtk_window_set_title(GTK_WINDOW(sw->dialog), title);
 +    g_object_set_data (G_OBJECT (sw->dialog), "dialog-info", sw);
 +
 +    // Set the style context for this dialog so it can be easily manipulated with css
 +    gnc_widget_set_style_context (GTK_WIDGET(sw->dialog), "GncSearchDialog");
 +
 +    /* Grab the result hbox */
 +    sw->result_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "result_hbox"));
 +
 +    /* Grab the search-table widget */
 +    sw->criteria_table = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_table"));
 +
 +    /* Set the type label */
 +    label = GTK_WIDGET(gtk_builder_get_object (builder, "type_label"));
 +    if (sw->type_label)
 +        type_label = sw->type_label;
 +    else
 +        type_label = _(qof_object_get_type_label (sw->search_for));
 +    gtk_label_set_text (GTK_LABEL (label), type_label);
 +
 +    /* Set the 'add criterion' button */
 +    add = gtk_button_new_with_mnemonic (_("_Add"));
 +
 +    g_signal_connect (G_OBJECT (add), "clicked", G_CALLBACK (add_criterion), sw);
 +    box = GTK_WIDGET(gtk_builder_get_object (builder, "add_button_box"));
 +    gtk_box_pack_start (GTK_BOX (box), add, FALSE, FALSE, 3);
 +    gtk_widget_show (add);
 +
 +    /* Set the match-type menu */
 +    sw->grouping_combo = gtk_combo_box_text_new();
 +    combo_box = GTK_COMBO_BOX_TEXT(sw->grouping_combo);
 +    gtk_combo_box_text_append_text(combo_box, _("all criteria are met"));
 +    gtk_combo_box_text_append_text(combo_box, _("any criteria are met"));
 +    gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), sw->grouping);
 +    g_signal_connect(combo_box, "changed", G_CALLBACK (match_combo_changed), sw);
 +
 +    box = GTK_WIDGET(gtk_builder_get_object (builder, "type_menu_box"));
 +    gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET(combo_box), FALSE, FALSE, 3);
 +    gtk_widget_show(GTK_WIDGET(combo_box));
 +
 +    /* Grab the 'all items match' label */
 +    sw->match_all_label = GTK_WIDGET(gtk_builder_get_object (builder, "match_all_label"));
 +
 +    /* if there's no original query, make the narrow, add, delete buttons inaccessible */
 +    sw->new_rb = GTK_WIDGET(gtk_builder_get_object (builder, "new_search_radiobutton"));
 +    g_signal_connect (sw->new_rb, "toggled",
 +                      G_CALLBACK (search_type_cb), sw);
 +    sw->narrow_rb = GTK_WIDGET(gtk_builder_get_object (builder, "narrow_search_radiobutton"));
 +    g_signal_connect (sw->narrow_rb, "toggled",
 +                      G_CALLBACK (search_type_cb), sw);
 +    sw->add_rb = GTK_WIDGET(gtk_builder_get_object (builder, "add_search_radiobutton"));
 +    g_signal_connect (sw->add_rb, "toggled",
 +                      G_CALLBACK (search_type_cb), sw);
 +    sw->del_rb = GTK_WIDGET(gtk_builder_get_object (builder, "delete_search_radiobutton"));
 +    g_signal_connect (sw->del_rb, "toggled",
 +                      G_CALLBACK (search_type_cb), sw);
 +
 +    active = gnc_prefs_get_bool(sw->prefs_group, GNC_PREF_ACTIVE_ONLY);
 +    sw->active_only_check = GTK_WIDGET(gtk_builder_get_object (builder, "active_only_check"));
 +    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sw->active_only_check), active);
 +    g_signal_connect (sw->active_only_check, "toggled",
 +                      G_CALLBACK (search_active_only_cb), sw);
 +
 +    /* Figure out if we this object-type has an "active" parameter, and
 +     * if not, then set the active-check button insensitive
 +     */
 +    if (qof_class_get_parameter (sw->search_for, QOF_PARAM_ACTIVE) == NULL)
 +        gtk_widget_set_sensitive (sw->active_only_check, FALSE);
 +
 +    /* Deal with the find button */
 +    widget = GTK_WIDGET(gtk_builder_get_object (builder, "find_button"));
 +    g_signal_connect (widget, "clicked",
 +                      G_CALLBACK (search_find_cb), sw);
 +
 +    /* Deal with the cancel button */
 +    sw->cancel_button = GTK_WIDGET(gtk_builder_get_object (builder, "cancel_button"));
 +    g_signal_connect (sw->cancel_button, "clicked",
 +                      G_CALLBACK (search_cancel_cb), sw);
 +
 +    /* Deal with the close button */
 +    sw->close_button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
 +    g_signal_connect (sw->close_button, "clicked",
 +                      G_CALLBACK (search_cancel_cb), sw);
 +
 +    /* Deal with the new_item button */
 +    new_item_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_item_button"));
 +    gtk_button_set_label (GTK_BUTTON(new_item_button),
 +                          type_label_to_new_button(type_label));
 +    g_signal_connect (new_item_button, "clicked",
 +                      G_CALLBACK (search_new_item_cb), sw);
 +
 +    /* Deal with the help button */
 +    widget = GTK_WIDGET(gtk_builder_get_object (builder, "help_button"));
 +    g_signal_connect (widget, "clicked",
 +                      G_CALLBACK (search_help_cb), sw);
 +
 +    /* add the first criterion */
 +    gnc_search_dialog_add_criterion (sw);
 +
 +    /* register to update criterion/criteria labels based on book option changes
 +     * if searching for splits */
 +    if (strcmp (sw->search_for, GNC_ID_SPLIT) == 0)
 +        gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
 +                                    gnc_search_dialog_book_option_changed, sw);
 +
 +    /* Hide the 'new' button if there is no new_item_cb */
 +    if (!sw->new_item_cb)
 +        gtk_widget_hide (new_item_button);
 +
 +    /* Connect all the signals */
 +    gtk_builder_connect_signals (builder, sw);
 +
 +    /* Register ourselves */
 +    sw->component_id = gnc_register_gui_component (DIALOG_SEARCH_CM_CLASS,
 +                       refresh_handler,
 +                       close_handler, sw);
 +    gnc_gui_component_set_session (sw->component_id,
 +                                   gnc_get_current_session());
 +
 +    /* And setup the close callback */
 +    g_signal_connect (G_OBJECT (sw->dialog), "destroy",
 +                      G_CALLBACK (gnc_search_dialog_close_cb), sw);
 +
 +    gnc_search_dialog_reset_widgets (sw);
 +    gnc_search_dialog_show_close_cancel (sw);
 +
 +    g_object_unref(G_OBJECT(builder));
 +}
 +
 +
 +void
 +gnc_search_dialog_destroy (GNCSearchWindow *sw)
 +{
 +    if (!sw) return;
 +    if (sw->prefs_group)
 +        gnc_save_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog));
 +    gnc_close_gui_component (sw->component_id);
 +}
 +
 +
 +void
 +gnc_search_dialog_raise (GNCSearchWindow *sw)
 +{
 +    if (!sw) return;
 +    gtk_window_present (GTK_WINDOW(sw->dialog));
 +}
 +
 +GNCSearchWindow *
 +gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
 +                          GList *param_list,
 +                          GList *display_list,
 +                          QofQuery *start_query, QofQuery *show_start_query,
 +                          GNCSearchCallbackButton *callbacks,
 +                          GNCSearchResultCB result_callback,
 +                          GNCSearchNewItemCB new_item_cb,
 +                          gpointer user_data, GNCSearchFree free_cb,
 +                          const gchar *prefs_group,
 +                          const gchar *type_label,
 +                          const gchar *style_class)
 +{
 +    GNCSearchWindow *sw = g_new0 (GNCSearchWindow, 1);
 +
 +    g_return_val_if_fail (obj_type, NULL);
 +    g_return_val_if_fail (*obj_type != '\0', NULL);
 +    g_return_val_if_fail (param_list, NULL);
 +
 +    /* Make sure the caller supplies callbacks xor result_callback */
 +    g_return_val_if_fail ((callbacks && !result_callback) ||
 +                          (!callbacks && result_callback), NULL);
 +
 +    if (callbacks)
 +        g_return_val_if_fail (display_list, NULL);
 +
 +    sw->search_for = obj_type;
 +    sw->params_list = param_list;
 +    sw->display_list = display_list;
 +    sw->buttons = callbacks;
 +    sw->result_cb = result_callback;
 +    sw->new_item_cb = new_item_cb;
 +    sw->user_data = user_data;
 +    sw->free_cb = free_cb;
 +    sw->prefs_group = prefs_group;
 +    sw->type_label = type_label;
 +
 +    /* Grab the get_guid function */
 +    sw->get_guid = qof_class_get_parameter (sw->search_for, QOF_PARAM_GUID);
 +    if (start_query)
 +        sw->start_q = qof_query_copy (start_query);
 +    sw->q = show_start_query;
 +
 +    gnc_search_dialog_init_widgets (sw, title);
 +    if (sw->prefs_group)
 +        gnc_restore_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog));
 +    gtk_widget_show(sw->dialog);
 +
 +    // Set the style context for this dialog so it can be easily manipulated with css
 +    if (style_class == NULL)
 +        gnc_widget_set_style_context (GTK_WIDGET(sw->dialog), "GncSearchDialog");
 +    else
 +        gnc_widget_set_style_context (GTK_WIDGET(sw->dialog), style_class);
 +
 +    /* Maybe display the original query results? */
 +    if (callbacks && show_start_query)
 +    {
 +        gnc_search_dialog_reset_widgets (sw);
 +        gnc_search_dialog_display_results (sw);
 +    }
 +
 +    return sw;
 +}
 +
 +
 +/* Register an on-close signal with the Search Dialog */
 +guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
 +        GCallback func,
 +        gpointer user_data)
 +{
 +    g_return_val_if_fail (sw, 0);
 +    g_return_val_if_fail (func, 0);
 +    g_return_val_if_fail (user_data, 0);
 +
 +    return g_signal_connect (G_OBJECT (sw->dialog), "destroy",
 +                             func, user_data);
 +
 +}
 +
 +
 +/* Un-register the signal handlers with the Search Dialog */
 +void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data)
 +{
 +    g_return_if_fail (sw);
 +    g_return_if_fail (user_data);
 +
 +    g_signal_handlers_disconnect_matched (sw->dialog, G_SIGNAL_MATCH_DATA,
 +                                          0, 0, NULL, NULL, user_data);
 +}
 +
 +
 +/* Clear all callbacks with this Search Window */
 +void gnc_search_dialog_set_select_cb (GNCSearchWindow *sw,
 +                                      GNCSearchSelectedCB selected_cb,
 +                                      gpointer user_data,
 +                                      gboolean allow_clear)
 +{
 +    g_return_if_fail (sw);
 +
 +    sw->selected_cb = selected_cb;
 +    sw->select_arg = user_data;
 +    sw->allow_clear = allow_clear;
 +
 +    /* Show or hide the select button */
 +    if (sw->select_button)
 +    {
 +        if (selected_cb)
 +            gtk_widget_show (sw->select_button);
 +        else
 +            gtk_widget_hide (sw->select_button);
 +    }
 +
 +    /* Show the proper close/cancel button */
 +    gnc_search_dialog_show_close_cancel (sw);
 +}
 +
 +
 +/* TEST CODE BELOW HERE */
 +
 +static GList *
 +get_params_list (QofIdTypeConst type)
 +{
 +    GList *list = NULL;
 +
 +    list = gnc_search_param_prepend (list, "Txn: All Accounts",
 +                                     ACCOUNT_MATCH_ALL_TYPE,
 +                                     type, SPLIT_TRANS, TRANS_SPLITLIST,
 +                                     SPLIT_ACCOUNT_GUID, NULL);
 +    list = gnc_search_param_prepend (list, "Split Account", GNC_ID_ACCOUNT,
 +                                     type, SPLIT_ACCOUNT, QOF_PARAM_GUID,
 +                                     NULL);
 +    list = gnc_search_param_prepend (list, "Split->Txn->Void?", NULL, type,
 +                                     SPLIT_TRANS, TRANS_VOID_STATUS, NULL);
 +    list = gnc_search_param_prepend (list, "Split Int64", NULL, type,
 +                                     "d-share-int64", NULL);
 +    list = gnc_search_param_prepend (list, "Split Amount (double)", NULL, type,
 +                                     "d-share-amount", NULL);
 +    list = gnc_search_param_prepend (list, "Split Value (debcred)", NULL, type,
 +                                     SPLIT_VALUE, NULL);
 +    list = gnc_search_param_prepend (list, "Split Amount (numeric)", NULL, type,
 +                                     SPLIT_AMOUNT, NULL);
 +    list = gnc_search_param_prepend (list, "Date Reconciled (date)", NULL, type,
 +                                     SPLIT_DATE_RECONCILED, NULL);
 +    list = gnc_search_param_prepend (list, "Split Memo (string)", NULL, type,
 +                                     SPLIT_MEMO, NULL);
 +
 +    return list;
 +}
 +
 +
 +static GList *
 +get_display_list (QofIdTypeConst type)
 +{
 +    GList *list = NULL;
 +
 +    list = gnc_search_param_prepend (list, "Amount", NULL, type, SPLIT_AMOUNT,
 +                                     NULL);
 +    list = gnc_search_param_prepend (list, "Memo", NULL, type, SPLIT_MEMO, NULL);
 +    list = gnc_search_param_prepend (list, "Date", NULL, type, SPLIT_TRANS,
 +                                     TRANS_DATE_POSTED, NULL);
 +
 +    return list;
 +}
 +
 +
 +static void
 +do_nothing (gpointer *a, gpointer b)
 +{
 +    return;
 +}
 +
 +
 +void
 +gnc_search_dialog_test (void)
 +{
 +    static GList *params = NULL;
 +    static GList *display = NULL;
 +    static GNCSearchCallbackButton buttons[] =
 +    {
 +        /* Don't mark these as translatable since these are only test strings! */
 +        { ("View Split"), do_nothing, NULL, TRUE },
 +        { ("New Split"), do_nothing, NULL, TRUE },
 +        { ("Do Something"), do_nothing, NULL, TRUE },
 +        { ("Do Nothing"), do_nothing, NULL, TRUE },
 +        { ("Who Cares?"), do_nothing, NULL, FALSE },
 +        { NULL }
 +    };
 +
 +    if (params == NULL)
 +        params = get_params_list (GNC_ID_SPLIT);
 +
 +    if (display == NULL)
 +        display = get_display_list (GNC_ID_SPLIT);
 +
 +/* FIXME: All this does is leak. */
 +    gnc_search_dialog_create (GNC_ID_SPLIT, _("Find Transaction"),
 +			      params, display,
 +			      NULL, NULL, buttons, NULL, NULL, NULL, NULL,
 +			      NULL, NULL, NULL);
 +}
 +
diff --cc gnucash/gnome-utils/gnc-tree-control-split-reg.c
index ea00d88,0000000..4bf3c1b
mode 100644,000000..100644
--- a/gnucash/gnome-utils/gnc-tree-control-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
@@@ -1,2173 -1,0 +1,2174 @@@
 +/********************************************************************\
 + * 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-date.h"
 +#include "gnc-ui.h"
 +#include "gnc-prefs.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),
++                              /* Translators: Return to the transaction to update */
 +                              _("_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 --cc gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
index 451b712,0000000..ce06a8f
mode 100644,000000..100644
--- a/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
+++ b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade
@@@ -1,3276 -1,0 +1,3278 @@@
++<?xml version="1.0" encoding="utf-8"?>
++<?xml version="1.0" encoding="utf-8"?>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!-- Generated with glade 3.20.0 -->
 +<interface>
 +  <requires lib="gtk+" version="3.10"/>
 +  <object class="GtkAdjustment" id="auto_decimal_places_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">8</property>
 +    <property name="value">2</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">4</property>
 +  </object>
 +  <object class="GtkAdjustment" id="autosave_interval_minutes_adj">
 +    <property name="upper">99999</property>
 +    <property name="value">3</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="date_backmonth_adj">
 +    <property name="upper">11</property>
 +    <property name="value">6</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">4</property>
 +  </object>
 +  <object class="GtkListStore" id="date_formats">
 +    <columns>
 +      <!-- column-name name -->
 +      <column type="gchararray"/>
 +      <!-- column-name example -->
 +      <column type="gchararray"/>
 +    </columns>
 +    <data>
 +      <row>
 +        <col id="0" translatable="yes">US</col>
 +        <col id="1" translatable="yes">07/31/2013</col>
 +      </row>
 +      <row>
 +        <col id="0" translatable="yes">UK</col>
 +        <col id="1" translatable="yes">31/07/2013</col>
 +      </row>
 +      <row>
 +        <col id="0" translatable="yes">Europe</col>
 +        <col id="1" translatable="yes">31.07.2013</col>
 +      </row>
 +      <row>
 +        <col id="0" translatable="yes">ISO</col>
 +        <col id="1" translatable="yes">2013-07-31</col>
 +      </row>
 +      <row>
 +        <col id="0" translatable="yes">Locale</col>
 +        <col id="1" translatable="yes">(dummy)</col>
 +      </row>
 +    </data>
 +  </object>
 +  <object class="GtkAdjustment" id="default_zoom_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">10</property>
 +    <property name="value">1</property>
 +    <property name="step_increment">0.10000000000000001</property>
 +    <property name="page_increment">1</property>
 +  </object>
 +  <object class="GtkAdjustment" id="key_length_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">999</property>
 +    <property name="value">2</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="max_transactions_adj">
 +    <property name="upper">999999</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="new_search_limit_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">100</property>
 +    <property name="value">1</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="retain_days_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">99999</property>
 +    <property name="value">30</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="save_on_close_adj">
 +    <property name="upper">300</property>
 +    <property name="value">20</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="tab_width_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">100</property>
 +    <property name="value">30</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkDialog" id="gnucash_preferences_dialog">
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">GnuCash Preferences</property>
 +    <property name="default_width">600</property>
 +    <property name="default_height">400</property>
 +    <property name="type_hint">normal</property>
 +    <signal name="response" handler="gnc_preferences_response_cb" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox2">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area2">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="helpbutton2">
 +                <property name="label" translatable="yes">_Help</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="closebutton2">
 +                <property name="label" translatable="yes">_Close</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkNotebook" id="notebook1">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="halign">start</property>
 +            <property name="border_width">6</property>
 +            <property name="tab_pos">left</property>
 +            <child>
 +              <object class="GtkGrid" id="table9">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <child>
 +                  <object class="GtkLabel" id="label91">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Summarybar Content</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/window.pages.account-tree.summary/grand-total">
 +                    <property name="label" translatable="yes">Include _grand total</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show a grand total of all accounts converted to the default report currency.</property>
 +                    <property name="tooltip_text" translatable="yes">Show a grand total of all accounts converted to the default report currency.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/window.pages.account-tree.summary/non-currency">
 +                    <property name="label" translatable="yes">Include _non-currency totals</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, non-currency commodities will be shown in the summary bar. If clear, only currencies will be shown.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, non-currency commodities will be shown in the summary bar. If clear, only currencies will be shown.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label93">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Start Date</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label95">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>End Date</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/window.pages.account-tree.summary/start-choice-relative">
 +                    <property name="label" translatable="yes">_Relative:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use the specified relative starting date for profit/loss calculations.</property>
 +                    <property name="tooltip_text" translatable="yes">Use the specified relative starting date for profit/loss calculations.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/window.pages.account-tree.summary/start-choice-absolute">
 +                    <property name="label" translatable="yes">_Absolute:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use the specified absolute starting date for profit/loss calculations.</property>
 +                    <property name="tooltip_text" translatable="yes">Use the specified absolute starting date for profit/loss calculations.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/window.pages.account-tree.summary/start-choice-relative</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/window.pages.account-tree.summary/end-choice-relative">
 +                    <property name="label" translatable="yes">Re_lative:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use the specified relative ending date for profit/loss calculations. Also use this date for net assets calculations.</property>
 +                    <property name="tooltip_text" translatable="yes">Use the specified relative ending date for profit/loss calculations. Also use this date for net assets calculations.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/window.pages.account-tree.summary/end-choice-absolute">
 +                    <property name="label" translatable="yes">Ab_solute:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use the specified absolute ending date for profit/loss calculations. Also use this date for net assets calculations.</property>
 +                    <property name="tooltip_text" translatable="yes">Use the specified absolute ending date for profit/loss calculations. Also use this date for net assets calculations.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/window.pages.account-tree.summary/end-choice-relative</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label94">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label92">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/window.pages.account-tree.summary/start-period">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/window.pages.account-tree.summary/start-date">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/window.pages.account-tree.summary/end-period">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/window.pages.account-tree.summary/end-date">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label107">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Accounting Period</property>
 +              </object>
 +              <packing>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table1">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <property name="column_spacing">12</property>
 +                <child>
 +                  <object class="GtkLabel" id="label12">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Separator Character</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/use-accounting-labels">
 +                    <property name="label" translatable="yes">Use _formal accounting labels</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use only &apos;debit&apos; and &apos;credit&apos; instead of informal synonyms.</property>
 +                    <property name="tooltip_text" translatable="yes">Use only 'debit' and 'credit' instead of informal synonyms.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label62">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Labels</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label61">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/reversed-accounts-none">
 +                    <property name="label" translatable="yes">_None</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Don&apos;t sign reverse any accounts.</property>
 +                    <property name="tooltip_text" translatable="yes">Don't sign reverse any accounts.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/reversed-accounts-credit">
 +                    <property name="label" translatable="yes">C_redit accounts</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Sign reverse balances on the following: Credit Card, Payable, Liability, Equity, and Income.</property>
 +                    <property name="tooltip_text" translatable="yes">Sign reverse balances on the following: Credit Card, Payable, Liability, Equity, and Income.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/reversed-accounts-none</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/reversed-accounts-incomeexpense">
 +                    <property name="label" translatable="yes">_Income & expense</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Sign reverse balances on income and expense accounts.</property>
 +                    <property name="tooltip_text" translatable="yes">Sign reverse balances on income and expense accounts.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/reversed-accounts-none</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label55">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Reverse Balanced Accounts</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label54">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label79">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label80">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Default Currency</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="locale_currency">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes">US Dollars (USD)</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">13</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment3">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <object class="GtkRadioButton" id="pref/general/currency-choice-other">
 +                        <property name="label" translatable="yes">Ch_oose:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Use the specified currency for all newly created accounts.</property>
 +                        <property name="tooltip_text" translatable="yes">Use the specified currency for all newly created accounts.</property>
 +                        <property name="halign">start</property>
 +                        <property name="margin_left">12</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">pref/general/currency-choice-locale</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">14</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="sample_account">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label108">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Character:</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label109">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Sample:</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/general/currency-other">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">14</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label11">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Account Color</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">16</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/show-account-color">
 +                    <property name="label" translatable="yes">Show the Account Color as background</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show the Account Color as Account Name Background.</property>
 +                    <property name="tooltip_text" translatable="yes">Show the Account Color as Account Name Background.</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">17</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label13">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">15</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/show-account-color-tabs">
 +                    <property name="label" translatable="yes">Show the Account Color on tabs</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show the Account Color as tab background.</property>
 +                    <property name="tooltip_text" translatable="yes">Show the Account Color as tab background.</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">18</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment2">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <object class="GtkRadioButton" id="pref/general/currency-choice-locale">
 +                        <property name="label" translatable="yes">Loc_ale:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Use the system locale currency for all newly created accounts.</property>
 +                        <property name="tooltip_text" translatable="yes">Use the system locale currency for all newly created accounts.</property>
 +                        <property name="halign">start</property>
 +                        <property name="margin_left">12</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="active">True</property>
 +                        <property name="draw_indicator">True</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">13</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox6">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <object class="GtkImage" id="separator_error">
 +                        <property name="can_focus">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="icon_name">dialog-warning</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkEntry" id="pref/general/account-separator">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="events">GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">The character that will be used between components of an account name. A legal value is any single character except letters and numbers, or any of the following strings: &quot;colon&quot; &quot;slash&quot;, &quot;backslash&quot;, &quot;dash&quot; and &quot;period&quot;.</property>
 +                        <property name="tooltip_text" translatable="yes">The character that will be used between components of an account name. A legal value is any single character except letters and numbers, or any of the following strings: "colon" "slash", "backslash", "dash" and "period".</property>
 +                        <property name="invisible_char">●</property>
 +                        <property name="primary_icon_activatable">False</property>
 +                        <property name="secondary_icon_activatable">False</property>
 +                        <signal name="changed" handler="gnc_account_separator_pref_changed_cb" swapped="no"/>
 +                        <signal name="focus-out-event" handler="gnc_account_separator_validate_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">True</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label1">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Accounts</property>
 +              </object>
 +              <packing>
 +                <property name="position">1</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table10">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <child>
 +                  <object class="GtkLabel" id="label104">
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Fancy Date Format</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label103">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label97">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Date Format</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label106">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Time Format</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label2">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/clock-24h">
 +                    <property name="label" translatable="yes">U_se 24-hour clock</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use a 24 hour (instead of a 12 hour) time format.</property>
 +                    <property name="tooltip_text" translatable="yes">Use a 24 hour (instead of a 12 hour) time format.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label9">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Date Completion</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label10">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">When a date is entered without year, it should be taken:</property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/date-completion-thisyear">
 +                    <property name="label" translatable="yes">In the current calendar year</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Dates will be completed so that they are within the current calendar year.</property>
 +                    <property name="tooltip_text" translatable="yes">Dates will be completed so that they are within the current calendar year.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/date-completion-sliding">
 +                    <property name="label" translatable="yes">In a sliding 12-month window starting this
 +many months before the current month:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Dates will be completed so that they are close to the current date. Enter the maximum number of months to go backwards in time when completing dates.</property>
 +                    <property name="tooltip_text" translatable="yes">Dates will be completed so that they are close to the current date. Enter the maximum number of months to go backwards in time when completing dates.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/date-completion-thisyear</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="pref/general/date-backmonths">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Enter number of months.</property>
 +                    <property name="tooltip_text" translatable="yes">Enter number of months.</property>
 +                    <property name="halign">start</property>
 +                    <property name="invisible_char">●</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">date_backmonth_adj</property>
 +                    <property name="climb_rate">1</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkComboBox" id="pref/general/date-format">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Use the date format specified by the system locale.</property>
 +                    <property name="tooltip_text" translatable="yes">Use the date format specified by the system locale.</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="model">date_formats</property>
 +                    <property name="active">3</property>
 +                    <child>
 +                      <object class="GtkCellRendererText" id="format_renderer"/>
 +                      <attributes>
 +                        <attribute name="text">0</attribute>
 +                      </attributes>
 +                    </child>
 +                    <child>
 +                      <object class="GtkCellRendererText" id="example_renderer"/>
 +                      <attributes>
 +                        <attribute name="text">1</attribute>
 +                      </attributes>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label105">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Date/Time</property>
 +              </object>
 +              <packing>
 +                <property name="position">2</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table2">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <child>
 +                  <object class="GtkLabel" id="label50">
 +                    <property name="visible">True</property>
-                     <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>General</b></property>
++                    <property name="label" translatable="yes"><b>General</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.new-hierarchy/show-on-new-file">
 +                    <property name="label" translatable="yes">Perform account list _setup on new file</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Present the new account list dialog when you choose File -> New File.</property>
 +                    <property name="tooltip_text" translatable="yes">Present the new account list dialog when you choose File -> New File.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/num-source">
 +                    <property name="label" translatable="yes">Set book option on new files to use split "action" field for "Num" field on registers/reports</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If selected, the default book option for new files is set so that the &quot;Num&quot; cell on registers shows/updates the split &quot;action&quot; field and the transaction &quot;num&quot; field is shown on the second line in double line mode (and is not visible in single line mode). Otherwise, the default book option for new files is set so that the &quot;Num&quot; cell on registers shows/updates the transaction &quot;num&quot; field.</property>
 +                    <property name="tooltip_text" translatable="yes">If selected, the default book option for new files is set so that the 'Num' cell on registers shows/updates the split 'action' field and the transaction 'num' field is shown on the second line in double line mode (and is not visible in single line mode). Otherwise, the default book option for new files is set so that the 'Num' cell on registers shows/updates the transaction 'num' field.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.totd/show-at-startup">
 +                    <property name="label" translatable="yes">Display "_tip of the day" dialog</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display hints for using GnuCash at startup.</property>
 +                    <property name="tooltip_text" translatable="yes">Display hints for using GnuCash at startup.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox2">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="spacing">6</property>
 +                    <child>
 +                      <object class="GtkSpinButton" id="pref/general/retain-days">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">How many days to keep old log/backup files.</property>
 +                        <property name="tooltip_text" translatable="yes">How many days to keep old log/backup files.</property>
 +                        <property name="invisible_char">●</property>
 +                        <property name="primary_icon_activatable">False</property>
 +                        <property name="secondary_icon_activatable">False</property>
 +                        <property name="adjustment">retain_days_adj</property>
 +                        <property name="climb_rate">1</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label58">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes">days</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">False</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">23</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label18">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>_Retain log/backup files:</b></property>
 +                    <property name="use_markup">True</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general/retain-days</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">21</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/file-compression">
 +                    <property name="label" translatable="yes">Com_press files</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Compress the data file with gzip when saving it to disk.</property>
 +                    <property name="tooltip_text" translatable="yes">Compress the data file with gzip when saving it to disk.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">15</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label48">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Files</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">14</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label60">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">13</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label17">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">_Decimal places:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general/auto-decimal-places</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="pref/general/auto-decimal-places">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">How many automatic decimal places will be filled in.</property>
 +                    <property name="tooltip_text" translatable="yes">How many automatic decimal places will be filled in.</property>
 +                    <property name="invisible_char">●</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">auto_decimal_places_adj</property>
 +                    <property name="climb_rate">1</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/auto-decimal-point">
 +                    <property name="label" translatable="yes">_Automatic decimal point</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Automatically insert a decimal point into values that are entered without one.</property>
 +                    <property name="tooltip_text" translatable="yes">Automatically insert a decimal point into values that are entered without one.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/negative-in-red">
 +                    <property name="label" translatable="yes">Display ne_gative amounts in red</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display negative amounts in red.</property>
 +                    <property name="tooltip_text" translatable="yes">Display negative amounts in red.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label49">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Numbers</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label51">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label78">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Search Dialog</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">28</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label44">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">New search _limit:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/dialogs.search/new-search-limit</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">29</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="pref/dialogs.search/new-search-limit">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Default to &apos;new search&apos; if fewer than this number of items is returned.</property>
 +                    <property name="tooltip_text" translatable="yes">Default to 'new search' if fewer than this number of items is returned.</property>
 +                    <property name="invisible_char">●</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">new_search_limit_adj</property>
 +                    <property name="climb_rate">1</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">29</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/show-splash-screen">
 +                    <property name="label" translatable="yes">Show splash scree_n</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show splash screen at startup.</property>
 +                    <property name="tooltip_text" translatable="yes">Show splash screen at startup.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label119">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Auto-save time _interval:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general/autosave-interval-minutes</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">17</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox4">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="spacing">6</property>
 +                    <child>
 +                      <object class="GtkSpinButton" id="pref/general/autosave-interval-minutes">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">The number of minutes until saving of the data file to harddisk will be started automatically. If zero, no saving will be started automatically.</property>
 +                        <property name="tooltip_text" translatable="yes">The number of minutes until saving of the data file to harddisk will be started automatically. If zero, no saving will be started automatically.</property>
 +                        <property name="invisible_char">●</property>
 +                        <property name="primary_icon_activatable">False</property>
 +                        <property name="secondary_icon_activatable">False</property>
 +                        <property name="adjustment">autosave_interval_minutes_adj</property>
 +                        <property name="climb_rate">1</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label120">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes">minutes</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">False</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">17</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/autosave-show-explanation">
 +                    <property name="label" translatable="yes">Show auto-save confirmation _question</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If active, GnuCash shows a confirmation question each time the auto-save feature is started. Otherwise no extra explanation is shown.</property>
 +                    <property name="tooltip_text" translatable="yes">If active, GnuCash shows a confirmation question each time the auto-save feature is started. Otherwise no extra explanation is shown.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">16</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label84">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">20</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/retain-type-never">
 +                    <property name="label" translatable="yes">Never</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Do not create log/backup files.</property>
 +                    <property name="tooltip_text" translatable="yes">Do not create log/backup files.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/retain-type-days</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">22</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/retain-type-days">
 +                    <property name="label" translatable="yes">For:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Delete old log/backup files after this many days (0 = never).</property>
 +                    <property name="tooltip_text" translatable="yes">Delete old log/backup files after this many days (0 = never).</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">23</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/retain-type-forever">
 +                    <property name="label" translatable="yes">Forever</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Do not delete log/backup files.</property>
 +                    <property name="tooltip_text" translatable="yes">Do not delete log/backup files.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/retain-type-days</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">24</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/save-on-close-expires">
 +                    <property name="label" translatable="yes">Enable timeout on "Save changes on closing" question</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="tooltip_text" translatable="yes">If enabled, the "Save changes on closing" question will only wait a limited number of seconds for an answer. If the user didn't answer within that time, the changes will be saved automatically and the question window closed.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">18</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label15">
 +                    <property name="visible">True</property>
-                     <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Time to wait for answer:</property>
++                    <property name="label" translatable="yes">Time to wait for answer:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general/autosave-interval-minutes</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">19</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox1">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="spacing">6</property>
 +                    <child>
 +                      <object class="GtkSpinButton" id="pref/general/save-on-close-wait-time">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="tooltip_text" translatable="yes">The number of seconds to wait before the question window will be closed and the changes saved automatically.</property>
 +                        <property name="invisible_char">●</property>
 +                        <property name="primary_icon_activatable">False</property>
 +                        <property name="secondary_icon_activatable">False</property>
 +                        <property name="adjustment">save_on_close_adj</property>
 +                        <property name="climb_rate">1</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label16">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes">seconds</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">False</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">19</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label19">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">25</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/general/assoc-head">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="tooltip_markup" translatable="yes">Path head for Transaction Associated files </property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">26</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="box1">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <object class="GtkLabel" id="label20">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes"><b>Path head for Transaction Association Files</b></property>
 +                        <property name="use_markup">True</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkImage" id="path_head_error">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="margin_left">12</property>
 +                        <property name="icon_name">dialog-warning</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">26</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/grid-lines-horizontal">
 +                    <property name="label" translatable="yes">Enable horizontal grid lines on table displays</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="tooltip_text" translatable="yes">Enable horizontal grid lines on table displays. These will mainly be tree views like the Accounts page.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/grid-lines-vertical">
 +                    <property name="label" translatable="yes">Enable vertical grid lines on table displays</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="tooltip_text" translatable="yes">Enable vertical grid lines on table displays. These will mainly be tree views like the Accounts page.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">3</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label3">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">General</property>
 +              </object>
 +              <packing>
 +                <property name="position">3</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table11">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <property name="column_spacing">12</property>
 +                <child>
 +                  <object class="GtkLabel" id="label115">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Checks</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment7">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkCheckButton" id="pref/dialogs.checkprinting/print-date-format">
 +                        <property name="label" translatable="yes">Print _date format</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Below the actual date, print the format of that date in 8 point type.</property>
 +                        <property name="tooltip_text" translatable="yes">Below the actual date, print the format of that date in 8 point type.</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment6">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkLabel" id="label116">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="label" translatable="yes">Default _font:</property>
 +                        <property name="use_markup">True</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="mnemonic_widget">pref/dialogs.checkprinting/default-font</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkFontButton" id="pref/dialogs.checkprinting/default-font">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">The default check printing font.</property>
 +                    <property name="tooltip_text" translatable="yes">The default check printing font.</property>
 +                    <property name="font">Sans 12</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment8">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkCheckButton" id="pref/dialogs.checkprinting/blocking-chars">
 +                        <property name="label" translatable="yes">Print _blocking chars</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Print &apos;***&apos; before and after each text field on the check.</property>
 +                        <property name="tooltip_text" translatable="yes">Print '***' before and after each text field on the check.</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">4</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label114">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Printing</property>
 +              </object>
 +              <packing>
 +                <property name="position">4</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table3">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <property name="column_spacing">12</property>
 +                <child>
 +                  <object class="GtkLabel" id="label56">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Actions</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/enter-moves-to-end">
 +                    <property name="label" translatable="yes">'_Enter' moves to blank transaction</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, pressing the &apos;Enter&apos; key will move to the location of the blank transaction in the register. If clear, pressing the &apos;Enter&apos; key will move down one row.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, pressing the 'Enter' key will move to the location of the blank transaction in the register. If clear, pressing the 'Enter' key will move down one row.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label66">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/auto-raise-lists">
 +                    <property name="label" translatable="yes">_Auto-raise lists</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Automatically raise the list of accounts or actions during input.</property>
 +                    <property name="tooltip_text" translatable="yes">Automatically raise the list of accounts or actions during input.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label75">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Reconciling</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label76">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.reconcile/check-cleared">
 +                    <property name="label" translatable="yes">Check cleared _transactions</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Pre-check cleared transactions when creating a reconcile dialog.</property>
 +                    <property name="tooltip_text" translatable="yes">Pre-check cleared transactions when creating a reconcile dialog.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.reconcile/auto-interest-transfer">
 +                    <property name="label" translatable="yes">Automatic _interest transfer</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
 +                    <property name="tooltip_text" translatable="yes">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.reconcile/auto-cc-payment">
 +                    <property name="label" translatable="yes">Automatic credit card _payment</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">After reconciling a credit card statement, prompt the user to enter a credit card payment.</property>
 +                    <property name="tooltip_text" translatable="yes">After reconciling a credit card statement, prompt the user to enter a credit card payment.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/dialogs.reconcile/always-reconcile-to-today">
 +                    <property name="label" translatable="yes">Always reconcile to t_oday</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Always open the reconcile dialog using today&apos;s date for the statement date, regardless of previous reconciliations.</property>
 +                    <property name="tooltip_text" translatable="yes">Always open the reconcile dialog using today's date for the statement date, regardless of previous reconciliations.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/draw-vertical-lines">
 +                    <property name="label" translatable="yes">Draw _vertical lines between columns</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show vertical borders on the cells.</property>
 +                    <property name="tooltip_text" translatable="yes">Show vertical borders on the cells.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">15</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label46">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">16</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label47">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Layout</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">17</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/future-after-blank-transaction">
 +                    <property name="label" translatable="yes">_Future transactions after blank transaction</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, transactions with a date in the future will be displayed at the bottom of the register after the blank transaction. If clear, the blank transaction will be at the bottom of the register after all transactions.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">18</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/draw-horizontal-lines">
 +                    <property name="label" translatable="yes">Draw hori_zontal lines between rows</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show horizontal borders on the cells.</property>
 +                    <property name="tooltip_text" translatable="yes">Show horizontal borders on the cells.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">14</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/alternate-color-by-transaction">
 +                    <property name="label" translatable="yes">Double _mode colors alternate with transactions</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Alternate the primary and secondary colors by transaction instead of by alternating by row.</property>
 +                    <property name="tooltip_text" translatable="yes">Alternate the primary and secondary colors by transaction instead of by alternating by row.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">13</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/use-theme-colors">
 +                    <property name="label" translatable="yes">Don't _use GnuCash built-in colors</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">GnuCash uses a yellow/green theme by default for register windows. Check this if you want to use the system color theme instead.</property>
 +                    <property name="tooltip_text" translatable="yes">GnuCash uses a yellow/green theme by default for register windows. Check this if you want to use the system color theme instead.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label45">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Graphics</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/tab-to-transfer-on-memorised">
 +                    <property name="label" translatable="yes">Tab order in_cludes Transfer on Memorised Transactions</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Move to Transfer field when memorised transaction auto filled.</property>
 +                    <property name="tooltip_text" translatable="yes">Move to Transfer field when memorised transaction auto filled.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label121">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">5</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label4">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Register</property>
 +              </object>
 +              <packing>
 +                <property name="position">5</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table4">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <child>
 +                  <object class="GtkLabel" id="label63">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Default Style</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label64">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label65">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Other Defaults</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general.register/default-style-ledger">
 +                    <property name="label" translatable="yes">_Basic ledger</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show all transactions on one line. (Two in double line mode.)</property>
 +                    <property name="tooltip_text" translatable="yes">Show all transactions on one line. (Two in double line mode.)</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general.register/default-style-autoledger">
 +                    <property name="label" translatable="yes">_Auto-split ledger</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Automatically expand the current transaction to show all splits. All other transactions are shown on one line. (Two in double line mode.)</property>
 +                    <property name="tooltip_text" translatable="yes">Automatically expand the current transaction to show all splits. All other transactions are shown on one line. (Two in double line mode.)</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general.register/default-style-ledger</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general.register/default-style-journal">
 +                    <property name="label" translatable="yes">Transaction _Journal</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">All transactions are expanded to show all splits.</property>
 +                    <property name="tooltip_text" translatable="yes">All transactions are expanded to show all splits.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general.register/default-style-ledger</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label59">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Number of _transactions:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general.register/max-transactions</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="pref/general.register/max-transactions">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show this many transactions in a register. A value of zero means show all transactions.</property>
 +                    <property name="tooltip_text" translatable="yes">Show this many transactions in a register. A value of zero means show all transactions.</property>
 +                    <property name="invisible_char">●</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">max_transactions_adj</property>
 +                    <property name="climb_rate">1</property>
 +                    <property name="snap_to_ticks">True</property>
 +                    <property name="numeric">True</property>
 +                    <property name="update_policy">if-valid</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/double-line-mode">
 +                    <property name="label" translatable="yes">_Double line mode</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show two lines of information for each transaction instead of one. Does not affect expanded transactions.</property>
 +                    <property name="tooltip_text" translatable="yes">Show two lines of information for each transaction instead of one. Does not affect expanded transactions.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/use-new-window">
 +                    <property name="label" translatable="yes">Register opens in a new _window</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, each register will be opened in its own top level window. If clear, the register will be opened in the current window.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, each register will be opened in its own top level window. If clear, the register will be opened in the current window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/show-leaf-account-names">
 +                    <property name="label" translatable="yes">_Only display leaf account names</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, only the names of the leaf accounts are displayed in the register and in the account selection popup. The default behaviour is to display the full name, including the path in the account tree. Checking this option implies that you use unique leaf names.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, only the names of the leaf accounts are displayed in the register and in the account selection popup. The default behaviour is to display the full name, including the path in the account tree. Checking this option implies that you use unique leaf names.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label14">
 +                    <property name="visible">True</property>
-                     <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="label" translatable="yes">Number of _characters for auto complete:</property>
++                    <property name="label" translatable="yes">Number of _characters for auto complete:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="mnemonic_widget">pref/general.register/key-length</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="pref/general.register/key-length">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
-                     <property name="tooltip_text" translatable="yes">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
++                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
 +                    <property name="invisible_char">●</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">key_length_adj</property>
 +                    <property name="climb_rate">1</property>
 +                    <property name="snap_to_ticks">True</property>
 +                    <property name="numeric">True</property>
 +                    <property name="update_policy">if-valid</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/show-extra-dates">
-                     <property name="label" translatable="yes">Show the _entered and reconcile dates</property>
++                    <property name="label" translatable="yes" comments="Register2 feature">Show the _entered and reconcile dates</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
-                     <property name="tooltip_markup">Show the date when the transaction was entered below the posted date and reconciled date on split row.</property>
 +                    <property name="tooltip_text" translatable="yes">Show the date when the transaction was entered below the posted date and reconciled date on split row.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
++                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/show-calendar-buttons">
-                     <property name="label" translatable="yes">Show the calendar b_uttons</property>
++                    <property name="label" translatable="yes" comments="Register2 feature">Show the calendar b_uttons</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
-                     <property name="tooltip_markup">Show the calendar buttons Cancel, Today and Select.</property>
 +                    <property name="tooltip_text" translatable="yes">Show the calendar buttons Cancel, Today and Select.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
++                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">13</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/selection-to-blank-on-expand">
-                     <property name="label" translatable="yes">_Move the selection to the blank split on expand</property>
++                    <property name="label" translatable="yes" comments="Register2 feature">_Move the selection to the blank split on expand</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
-                     <property name="tooltip_markup">This will move the selection to the blank split when the transaction is expanded.</property>
 +                    <property name="tooltip_text" translatable="yes">This will move the selection to the blank split when the transaction is expanded.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
++                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">14</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.register/show-extra-dates-on-selection">
-                     <property name="label" translatable="yes">_Show entered and reconciled dates on selection</property>
++                    <property name="label" translatable="yes" comments="Register2 feature">_Show entered and reconciled dates on selection</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
-                     <property name="tooltip_markup">Show the entered date and reconciled date on transaction selection.</property>
 +                    <property name="tooltip_text" translatable="yes">Show the entered date and reconciled date on transaction selection.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
++                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">6</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label5">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Register Defaults</property>
 +              </object>
 +              <packing>
 +                <property name="position">6</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table8">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <child>
 +                  <object class="GtkLabel" id="locale_currency2">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes">US Dollars (USD)</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment5">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkRadioButton" id="pref/general.report/currency-choice-other">
 +                        <property name="label" translatable="yes">Ch_oose:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Use the specified currency for all newly created reports.</property>
 +                        <property name="tooltip_text" translatable="yes">Use the specified currency for all newly created reports.</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="active">True</property>
 +                        <property name="draw_indicator">True</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment4">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkRadioButton" id="pref/general.report/currency-choice-locale">
 +                        <property name="label" translatable="yes">Loc_ale:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">Use the system locale currency for all newly created reports.</property>
 +                        <property name="tooltip_text" translatable="yes">Use the system locale currency for all newly created reports.</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">pref/general.report/currency-choice-other</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label86">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Default Report Currency</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label88">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label89">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Location</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general.report/use-new-window">
 +                    <property name="label" translatable="yes">Report opens in a new _window</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">If checked, each report will be opened in its own top level window. If clear, the report will be opened in the current window.</property>
 +                    <property name="tooltip_text" translatable="yes">If checked, each report will be opened in its own top level window. If clear, the report will be opened in the current window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="pref/general.report/currency-other">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label21">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Default zoom level</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox5">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="orientation">vertical</property>
 +                    <child>
 +                      <object class="GtkSpinButton" id="pref/general.report/default-zoom">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="tooltip_text" translatable="yes">On high resolution screens reports tend to be hard to read. This option allows you to scale reports up by the set factor. For example setting this to 2.0 will display reports at twice their typical size.</property>
 +                        <property name="halign">start</property>
 +                        <property name="adjustment">default_zoom_adj</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">7</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label6">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Reports</property>
 +              </object>
 +              <packing>
 +                <property name="position">7</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkGrid" id="table5">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">6</property>
 +                <property name="column_spacing">12</property>
 +                <child>
 +                  <object class="GtkLabel" id="label72">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Window Geometry</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label74">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/save-window-geometry">
 +                    <property name="label" translatable="yes">_Save window size and position</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Save window size and location when it is closed.</property>
 +                    <property name="tooltip_text" translatable="yes">Save window size and location when it is closed.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/tab-next-recent">
 +                    <property name="label" translatable="yes">Bring the most _recent tab to the front</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Closing a tab moves to the most recently visited tab.</property>
 +                    <property name="tooltip_text" translatable="yes">Closing a tab moves to the most recently visited tab.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">5</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label110">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">7</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label111">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Tab Position</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/tab-position-top">
 +                    <property name="label" translatable="yes">To_p</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the notebook tabs at the top of the window.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the notebook tabs at the top of the window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/tab-position-bottom">
 +                    <property name="label" translatable="yes">B_ottom</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the notebook tabs at the bottom of the window.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the notebook tabs at the bottom of the window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/tab-position-top</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/tab-position-left">
 +                    <property name="label" translatable="yes">_Left</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the notebook tabs at the left of the window.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the notebook tabs at the left of the window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/tab-position-top</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">11</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/tab-position-right">
 +                    <property name="label" translatable="yes">_Right</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the notebook tabs at the right of the window.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the notebook tabs at the right of the window.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/tab-position-top</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">12</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label7">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Summary Bar Position</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">8</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/summarybar-position-top">
 +                    <property name="label" translatable="yes">Top</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the summary bar at the top of the page.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the summary bar at the top of the page.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="active">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">9</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="pref/general/summarybar-position-bottom">
 +                    <property name="label" translatable="yes">Bottom</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Display the summary bar at the bottom of the page.</property>
 +                    <property name="tooltip_text" translatable="yes">Display the summary bar at the bottom of the page.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">pref/general/summarybar-position-top</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">10</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label112">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label113">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes"><b>Tabs</b></property>
 +                    <property name="use_markup">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">3</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="pref/general/tab-close-buttons">
 +                    <property name="label" translatable="yes">Show close button on _notebook tabs</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="has_tooltip">True</property>
 +                    <property name="tooltip_markup">Show a close button on each notebook tab. These function identically to the &apos;Close&apos; menu item.</property>
 +                    <property name="tooltip_text" translatable="yes">Show a close button on each notebook tab. These function identically to the 'Close' menu item.</property>
 +                    <property name="halign">start</property>
 +                    <property name="margin_left">12</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">4</property>
 +                    <property name="width">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkAlignment" id="alignment9">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="left_padding">12</property>
 +                    <child>
 +                      <object class="GtkLabel" id="label117">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="label" translatable="yes">_Width:</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="ellipsize">middle</property>
 +                      </object>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox3">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <object class="GtkSpinButton" id="pref/general/tab-width">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="has_tooltip">True</property>
 +                        <property name="tooltip_markup">If the text in the tab is longer than this value (the test is approximate) then the tab label will have the middle cut and replaced with an ellipsis.</property>
 +                        <property name="tooltip_text" translatable="yes">If the text in the tab is longer than this value (the test is approximate) then the tab label will have the middle cut and replaced with an ellipsis.</property>
 +                        <property name="invisible_char">●</property>
 +                        <property name="primary_icon_activatable">False</property>
 +                        <property name="secondary_icon_activatable">False</property>
 +                        <property name="adjustment">tab_width_adj</property>
 +                        <property name="climb_rate">1</property>
 +                        <property name="numeric">True</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label118">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes">characters</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">False</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">6</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +                <child>
 +                  <placeholder/>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">8</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label8">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Windows</property>
 +              </object>
 +              <packing>
 +                <property name="position">8</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-11">helpbutton2</action-widget>
 +      <action-widget response="-7">closebutton2</action-widget>
 +    </action-widgets>
 +  </object>
 +</interface>
diff --cc gnucash/gnome/gnc-plugin-page-register.c
index de7be81,0000000..c34dbb9
mode 100644,000000..100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@@ -1,4192 -1,0 +1,4194 @@@
 +/**********************************************************************
 + * 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,
++        "ScrubAllAction", NULL,
++		/* Translators: The following 2 are Scrub actions in register view */
++		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 --cc gnucash/gnome/gnc-split-reg.c
index 5e661f2,0000000..678d1b5
mode 100644,000000..100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@@ -1,2258 -1,0 +1,2260 @@@
 +/********************************************************************\
 + * 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"),
++    gnc_gtk_dialog_add_button(dialog,
++                              /* Translators: This is the confirmation button in a warning 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 --cc gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
index a04c1ff,0000000..ce244d0
mode 100644,000000..100644
--- a/gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
+++ b/gnucash/gnome/gtkbuilder/gnc-plugin-page-register.glade
@@@ -1,1167 -1,0 +1,1169 @@@
++<?xml version="1.0" encoding="utf-8"?>
++<?xml version="1.0" encoding="utf-8"?>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!-- Generated with glade 3.20.0 -->
- <interface>
 +  <requires lib="gtk+" version="3.10"/>
 +  <object class="GtkDialog" id="filter_by_dialog">
++  <object class="GtkDialog" id="filter_by_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="border_width">6</property>
-     <property name="title" translatable="yes">Filter register by...</property>
++    <property name="title" translatable="yes" comments="Filter register by... Dialog">Filter register by...</property>
 +    <property name="resizable">False</property>
 +    <property name="destroy_with_parent">True</property>
 +    <property name="type_hint">dialog</property>
 +    <signal name="response" handler="gnc_plugin_page_register_filter_response_cb" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox19">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <property name="spacing">6</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area21">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="cancelbutton4">
 +                <property name="label" translatable="yes">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="okbutton4">
 +                <property name="label" translatable="yes">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="has_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkNotebook" id="notebook1">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <child>
 +              <object class="GtkBox" id="vbox103">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="border_width">12</property>
 +                <property name="orientation">vertical</property>
 +                <child>
 +                  <object class="GtkRadioButton" id="filter_show_all">
-                     <property name="label" translatable="yes">Show _All</property>
++                    <property name="label" translatable="yes" comments="Filter By Dialog, Date Tab">Show _All</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">False</property>
 +                    <property name="fill">False</property>
 +                    <property name="position">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="label847680">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">False</property>
 +                    <property name="fill">False</property>
 +                    <property name="position">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkRadioButton" id="filter_show_range">
 +                    <property name="label" translatable="yes">Select Range:</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <property name="group">filter_show_all</property>
 +                    <signal name="toggled" handler="gnc_plugin_page_register_filter_select_range_cb" swapped="no"/>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">False</property>
 +                    <property name="fill">False</property>
 +                    <property name="position">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkGrid" id="select_range_table">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="column_spacing">6</property>
 +                    <child>
 +                      <object class="GtkLabel" id="label847682">
 +                        <property name="visible">True</property>
-                         <property name="can_focus">False</property>
++                        <property name="label" translatable="yes">Start:</property>
 +                        <property name="label" translatable="yes">Start:</property>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="start_date_earliest">
 +                        <property name="label" translatable="yes">_Earliest</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_start_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="end_date_choose">
 +                        <property name="label" translatable="yes">Choo_se Date:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_end_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">6</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="end_date_today">
 +                        <property name="label" translatable="yes">Toda_y</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">end_date_choose</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_end_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">5</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="end_date_latest">
 +                        <property name="label" translatable="yes">_Latest</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">end_date_choose</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_end_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">4</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label847683">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">3</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkLabel" id="label847684">
 +                        <property name="visible">True</property>
-                         <property name="can_focus">False</property>
++                        <property name="label" translatable="yes">End:</property>
 +                        <property name="label" translatable="yes">End:</property>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">4</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="start_date_choose">
 +                        <property name="label" translatable="yes">C_hoose Date:</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">start_date_earliest</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_start_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">2</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkRadioButton" id="start_date_today">
 +                        <property name="label" translatable="yes">_Today</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <property name="group">start_date_earliest</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_start_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">1</property>
 +                        <property name="top_attach">1</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkBox" id="start_date_hbox">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <child>
 +                          <placeholder/>
 +                        </child>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">2</property>
 +                        <property name="top_attach">2</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkBox" id="end_date_hbox">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <child>
 +                          <placeholder/>
 +                        </child>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">2</property>
 +                        <property name="top_attach">6</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">True</property>
 +                    <property name="fill">True</property>
 +                    <property name="position">3</property>
 +                  </packing>
 +                </child>
 +              </object>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label847678">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">Date</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkBox" id="vbox104">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="orientation">vertical</property>
 +                <child>
 +                  <object class="GtkGrid" id="table1">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="border_width">12</property>
 +                    <child>
 +                      <object class="GtkCheckButton" id="filter_status_unreconciled">
-                         <property name="label" translatable="yes">_Unreconciled</property>
++                        <property name="label" translatable="yes" comments="Filter By Dialog, State Tab">_Unreconciled</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="toggled" handler="gnc_plugin_page_register_filter_status_one_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkCheckButton" id="filter_status_reconciled">
 +                        <property name="label" translatable="yes">_Reconciled</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="toggled" handler="gnc_plugin_page_register_filter_status_one_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">1</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkCheckButton" id="filter_status_cleared">
 +                        <property name="label" translatable="yes">C_leared</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="toggled" handler="gnc_plugin_page_register_filter_status_one_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">2</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkCheckButton" id="filter_status_voided">
 +                        <property name="label" translatable="yes">_Voided</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="toggled" handler="gnc_plugin_page_register_filter_status_one_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">3</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkCheckButton" id="filter_status_frozen">
 +                        <property name="label" translatable="yes">_Frozen</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">False</property>
 +                        <property name="halign">start</property>
 +                        <property name="use_underline">True</property>
 +                        <property name="draw_indicator">True</property>
 +                        <signal name="toggled" handler="gnc_plugin_page_register_filter_status_one_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">4</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkButton" id="button84">
 +                        <property name="label" translatable="yes">Select _All</property>
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">True</property>
 +                        <property name="receives_default">True</property>
 +                        <property name="halign">center</property>
 +                        <property name="use_underline">True</property>
 +                        <signal name="clicked" handler="gnc_plugin_page_register_filter_status_all_cb" swapped="no"/>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">6</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkSeparator" id="hseparator1">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="margin_top">5</property>
 +                        <property name="margin_bottom">5</property>
 +                        <property name="hexpand">True</property>
 +                      </object>
 +                      <packing>
 +                        <property name="left_attach">0</property>
 +                        <property name="top_attach">5</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">True</property>
 +                    <property name="fill">True</property>
 +                    <property name="position">0</property>
 +                  </packing>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child type="tab">
 +              <object class="GtkLabel" id="label847679">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">Status</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="position">1</property>
 +                <property name="tab_fill">False</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">1</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkBox" id="hbox1">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <child>
 +              <object class="GtkCheckButton" id="filter_save">
-                 <property name="label" translatable="yes">Sa_ve Filter</property>
++                <property name="label" translatable="yes" comments="Filter By Dialog, below tabs">Sa_ve Filter</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_filter_save_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="padding">6</property>
 +                <property name="pack_type">end</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">False</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">cancelbutton4</action-widget>
 +      <action-widget response="-5">okbutton4</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkAdjustment" id="num_adjustment">
 +    <property name="upper">1000000000</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkDialog" id="sort_by_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="border_width">6</property>
-     <property name="title" translatable="yes">Sort register by...</property>
++    <property name="title" translatable="yes" comments="Sort register by Dialog">Sort register by...</property>
 +    <property name="resizable">False</property>
 +    <property name="window_position">center-on-parent</property>
 +    <property name="type_hint">dialog</property>
 +    <signal name="response" handler="gnc_plugin_page_register_sort_response_cb" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox17">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <property name="spacing">6</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area19">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="cancelbutton2">
 +                <property name="label" translatable="yes">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="okbutton2">
 +                <property name="label" translatable="yes">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="has_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkBox" id="vbox101">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="border_width">12</property>
 +            <property name="orientation">vertical</property>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_STANDARD">
 +                <property name="label" translatable="yes">_Standard Order</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Keep normal account order.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkSeparator" id="hseparator2">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">True</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_DATE">
 +                <property name="label" translatable="yes">_Date</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by date.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_DATE_ENTERED">
 +                <property name="label" translatable="yes">Date of _Entry</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by the date of entry.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">3</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_DATE_RECONCILED">
 +                <property name="label" translatable="yes">S_tatement Date</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by the statement date (and group by cleared, unreconciled, reconciled).</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">4</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_NUM">
 +                <property name="label" translatable="yes">Num_ber</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by number.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">5</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_AMOUNT">
 +                <property name="label" translatable="yes">Amo_unt</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by amount.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">6</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_MEMO">
 +                <property name="label" translatable="yes">_Memo</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by memo.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">7</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_DESC">
 +                <property name="label" translatable="yes">Descri_ption</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by description.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">8</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_ACTION">
 +                <property name="label" translatable="yes">_Action</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by action field.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">9</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkRadioButton" id="BY_NOTES">
 +                <property name="label" translatable="yes">_Notes</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="tooltip_text" translatable="yes">Sort by notes field.</property>
 +                <property name="halign">start</property>
 +                <property name="use_underline">True</property>
 +                <property name="draw_indicator">True</property>
 +                <property name="group">BY_STANDARD</property>
 +                <signal name="toggled" handler="gnc_plugin_page_register_sort_button_cb" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">10</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkSeparator" id="hseparator3">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">True</property>
 +                <property name="position">11</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label1">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +              </object>
 +              <packing>
 +                <property name="expand">True</property>
 +                <property name="fill">True</property>
 +                <property name="position">12</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkBox" id="hbox2">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <child>
 +                  <object class="GtkCheckButton" id="sort_save">
 +                    <property name="label" translatable="yes">Sa_ve Sort Order</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
 +                    <property name="tooltip_text" translatable="yes">Save the sort order for this register.</property>
 +                    <property name="halign">start</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="draw_indicator">True</property>
 +                    <signal name="toggled" handler="gnc_plugin_page_register_sort_order_save_cb" swapped="no"/>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">False</property>
 +                    <property name="fill">False</property>
 +                    <property name="padding">6</property>
 +                    <property name="pack_type">end</property>
 +                    <property name="position">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkCheckButton" id="sort_reverse">
-                     <property name="label" translatable="yes">Reverse Order</property>
++                    <property name="label" translatable="yes">_Reverse Order</property>
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="receives_default">False</property>
-                     <property name="tooltip_text" translatable="yes">Sort in descending order.</property>
++                    <property name="halign">start</property>
 +                    <property name="halign">start</property>
 +                    <property name="draw_indicator">True</property>
 +                    <signal name="toggled" handler="gnc_plugin_page_register_sort_order_reverse_cb" swapped="no"/>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">True</property>
 +                    <property name="fill">True</property>
 +                    <property name="position">1</property>
 +                  </packing>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="expand">True</property>
 +                <property name="fill">False</property>
 +                <property name="position">14</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">cancelbutton2</action-widget>
 +      <action-widget response="-5">okbutton2</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkAdjustment" id="tnum_adjustment">
 +    <property name="upper">1000000000</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkDialog" id="duplicate_transaction_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="border_width">6</property>
 +    <property name="title" translatable="yes">Duplicate Transaction</property>
 +    <property name="resizable">False</property>
 +    <property name="modal">True</property>
 +    <property name="type_hint">dialog</property>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox15">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <property name="spacing">6</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area15">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="button76">
 +                <property name="label" translatable="yes">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="button77">
 +                <property name="label" translatable="yes">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="has_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="duplicate_title_label">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="label" translatable="yes"><b>New Transaction Information</b></property>
 +            <property name="use_markup">True</property>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">False</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkAlignment" id="alignment1">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="left_padding">12</property>
 +            <child>
 +              <object class="GtkGrid" id="duplicate_table">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="row_spacing">6</property>
 +                <property name="column_spacing">12</property>
 +                <child>
 +                  <object class="GtkLabel" id="date_label">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes">_Date:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="justify">center</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="num_label">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes">_Number:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="justify">center</property>
 +                    <property name="mnemonic_widget">num_spin</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="num_spin">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="has_focus">True</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">num_adjustment</property>
 +                    <property name="climb_rate">1</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">1</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="date_hbox">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <child>
 +                      <placeholder/>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkLabel" id="tnum_label">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="halign">start</property>
 +                    <property name="label" translatable="yes">_Transaction Number:</property>
 +                    <property name="use_underline">True</property>
 +                    <property name="justify">center</property>
 +                    <property name="mnemonic_widget">tnum_spin</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">0</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkSpinButton" id="tnum_spin">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="primary_icon_activatable">False</property>
 +                    <property name="secondary_icon_activatable">False</property>
 +                    <property name="adjustment">tnum_adjustment</property>
 +                    <property name="climb_rate">1</property>
 +                  </object>
 +                  <packing>
 +                    <property name="left_attach">1</property>
 +                    <property name="top_attach">2</property>
 +                  </packing>
 +                </child>
 +              </object>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">3</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">button76</action-widget>
 +      <action-widget response="-5">button77</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkDialog" id="void_transaction_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="border_width">6</property>
 +    <property name="title" translatable="yes">Void Transaction</property>
 +    <property name="resizable">False</property>
 +    <property name="modal">True</property>
 +    <property name="window_position">center-on-parent</property>
 +    <property name="type_hint">dialog</property>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox16">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <property name="spacing">6</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area18">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="cancelbutton1">
 +                <property name="label" translatable="yes">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="okbutton1">
 +                <property name="label" translatable="yes">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="has_default">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkBox" id="vbox100">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="orientation">vertical</property>
 +            <child>
 +              <object class="GtkLabel" id="label847671">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">Reason for voiding transaction:</property>
 +                <property name="justify">center</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkEntry" id="reason">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="has_focus">True</property>
 +                <property name="activates_default">True</property>
 +                <property name="primary_icon_activatable">False</property>
 +                <property name="secondary_icon_activatable">False</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">cancelbutton1</action-widget>
 +      <action-widget response="-5">okbutton1</action-widget>
 +    </action-widgets>
 +  </object>
 +</interface>
diff --cc gnucash/import-export/csv-exp/csv-transactions-export.c
index 65c897d,0000000..5526362
mode 100644,000000..100644
--- a/gnucash/import-export/csv-exp/csv-transactions-export.c
+++ b/gnucash/import-export/csv-exp/csv-transactions-export.c
@@@ -1,659 -1,0 +1,662 @@@
 +/*******************************************************************\
-  * csv-transactions-export.c -- Export Transactions to a file       *
++ * csv-actions-export.c -- Export Transactions to a file       *
 + *                                                                  *
 + * 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                   *
 +\********************************************************************/
 +/** @file csv-transactions-export.c
 +    @brief CSV Export Transactions
 +    @author Copyright (c) 2012 Robert Fewell
 +*/
- #include <config.h>
++#include "config.h"
 +
 +#include <gtk/gtk.h>
 +#include <glib/gi18n.h>
 +#include <glib/gstdio.h>
 +
 +#include "gnc-commodity.h"
 +#include "gnc-ui-util.h"
 +#include "Query.h"
 +#include "Transaction.h"
 +#include "engine-helpers.h"
 +#include "qofbookslots.h"
 +
 +#include "csv-transactions-export.h"
 +
 +/* This static indicates the debugging module that this .o belongs to. */
 +static QofLogModule log_module = GNC_MOD_ASSISTANT;
 +
 +/* CSV spec requires CRLF line endings. Tweak the end-of-line string so this
 + * true for each platform */
 +#ifdef G_OS_WIN32
 +# define EOLSTR "\n"
 +#else
 +# define EOLSTR "\r\n"
 +#endif
 +
 +
 +/*******************************************************************/
 +
 +/*******************************************************
 + * write_line_to_file
 + *
 + * write a text string to a file pointer, return TRUE if
 + * successful.
 + *******************************************************/
 +static
 +gboolean write_line_to_file (FILE *fh, char * line)
 +{
 +    int len, written;
 +    DEBUG("Account String: %s", line);
 +
 +    /* Write account line */
 +    len = strlen (line);
 +    written = fwrite (line, 1, len, fh);
 +
 +    if (written != len)
 +        return FALSE;
 +    else
 +        return TRUE;
 +}
 +
 +
 +/*******************************************************
 + * csv_txn_test_field_string
 + *
 + * Test the field string for ," and new lines
 + *******************************************************/
 +static
 +gchar *csv_txn_test_field_string (CsvExportInfo *info, const gchar *string_in)
 +{
 +    gboolean need_quote = FALSE;
 +    gchar **parts;
 +    gchar *string_parts;
 +    gchar *string_out;
 +
 +    /* Check for " and then "" them */
 +    parts = g_strsplit (string_in, "\"", -1);
 +    string_parts = g_strjoinv ("\"\"", parts);
 +    g_strfreev (parts);
 +
 +    /* Check for separator string and \n and " in field,
 +       if so quote field if not already quoted */
 +    if (g_strrstr (string_parts, info->separator_str) != NULL)
 +        need_quote = TRUE;
 +    if (g_strrstr (string_parts, "\n") != NULL)
 +        need_quote = TRUE;
 +    if (g_strrstr (string_parts, "\"") != NULL)
 +        need_quote = TRUE;
 +
 +    if (!info->use_quotes && need_quote)
 +        string_out = g_strconcat ("\"", string_parts, "\"", NULL);
 +    else
 +        string_out = g_strdup (string_parts);
 +
 +    g_free (string_parts);
 +    return string_out;
 +}
 +
 +/******************** Helper functions *********************/
 +
 +// Transaction Date
 +static gchar*
 +add_date (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    gchar *date = qof_print_date (xaccTransGetDate (trans));
 +    gchar *result = g_strconcat (so_far, info->end_sep, date, info->mid_sep, NULL);
 +    g_free (date);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +
 +// Transaction GUID
 +static gchar*
 +add_guid (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    gchar *result;
 +    gchar *guid;
 +
 +    guid = guid_to_string (xaccTransGetGUID (trans));
 +    result = g_strconcat (so_far, guid, info->mid_sep, NULL);
 +    g_free (guid);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Reconcile Date
 +static gchar*
 +add_reconcile_date (gchar *so_far, Split *split, CsvExportInfo *info)
 +{
 +    gchar *result;
 +
 +    if (xaccSplitGetReconcile (split) == YREC)
 +    {
 +        Timespec     ts = {0,0};
 +        const gchar *str_rec_date;
 +        xaccSplitGetDateReconciledTS (split, &ts);
 +        str_rec_date = gnc_print_date (ts);
 +        result = g_strconcat (so_far, str_rec_date, info->mid_sep, NULL);
 +    }
 +    else
 +        result = g_strconcat (so_far, info->mid_sep, NULL);
 +
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Account Name short or Long
 +static gchar*
 +add_account_name (gchar *so_far, Split *split, gboolean full, CsvExportInfo *info)
 +{
 +    gchar       *name = NULL;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    Account     *account = xaccSplitGetAccount (split);
 +    if (full)
 +        name = gnc_account_get_full_name (account);
 +    else
 +        name = g_strdup (xaccAccountGetName (account));
 +    conv = csv_txn_test_field_string (info, name);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (name);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Number
 +static gchar*
 +add_number (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    const gchar *num;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    num = xaccTransGetNum (trans) ? xaccTransGetNum (trans) : "" ;
 +    conv = csv_txn_test_field_string (info, num);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Description
 +static gchar*
 +add_description (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    const gchar *desc;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    desc = xaccTransGetDescription (trans) ? xaccTransGetDescription (trans) : "" ;
 +    conv = csv_txn_test_field_string (info, desc);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Notes
 +static gchar*
 +add_notes (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    const gchar *notes;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    notes = xaccTransGetNotes (trans) ? xaccTransGetNotes (trans) : "" ;
 +    conv = csv_txn_test_field_string (info, notes);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Void reason
 +static gchar*
 +add_void_reason (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    gchar       *result;
 +
 +    if (xaccTransGetVoidStatus (trans))
 +    {
 +        const gchar *void_reason = xaccTransGetVoidReason (trans);
 +        gchar *conv = csv_txn_test_field_string (info, void_reason);
 +        result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +        g_free (conv);
 +    }
 +    else
 +        result = g_strconcat (so_far, info->mid_sep, NULL);
 +
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Memo
 +static gchar*
 +add_memo (gchar *so_far, Split *split, CsvExportInfo *info)
 +{
 +    const gchar *memo;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    memo = xaccSplitGetMemo (split) ? xaccSplitGetMemo (split) : "" ;
 +    conv = csv_txn_test_field_string (info, memo);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Full Category Path or Not
 +static gchar*
 +add_category (gchar *so_far, Split *split, gboolean full, CsvExportInfo *info)
 +{
 +    gchar       *cat;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    if (full)
 +        cat = xaccSplitGetCorrAccountFullName (split);
 +    else
 +        cat = g_strdup(xaccSplitGetCorrAccountName (split));
 +
 +    conv = csv_txn_test_field_string (info, cat);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (cat);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Action
 +static gchar*
 +add_action (gchar *so_far, Split *split, CsvExportInfo *info)
 +{
 +    const gchar *action = xaccSplitGetAction (split);
 +    gchar *conv = csv_txn_test_field_string (info, action);
 +    gchar *result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Reconcile
 +static gchar*
 +add_reconcile (gchar *so_far, Split *split, CsvExportInfo *info)
 +{
 +    const gchar *recon;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    recon = gnc_get_reconcile_str (xaccSplitGetReconcile (split));
 +    conv = csv_txn_test_field_string (info, recon);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Transaction commodity
 +static gchar*
 +add_commodity (gchar *so_far, Transaction *trans, CsvExportInfo *info)
 +{
 +    const gchar *comm_m;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    comm_m = gnc_commodity_get_unique_name (xaccTransGetCurrency (trans));
 +
 +    conv = csv_txn_test_field_string (info, comm_m);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Amount with Symbol or not
 +static gchar*
 +add_amount (gchar *so_far, Split *split, gboolean t_void, gboolean symbol, CsvExportInfo *info)
 +{
 +    const gchar *amt;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    if (t_void)
 +        amt = xaccPrintAmount (xaccSplitVoidFormerAmount (split), gnc_split_amount_print_info (split, symbol));
 +    else
 +        amt = xaccPrintAmount (xaccSplitGetAmount (split), gnc_split_amount_print_info (split, symbol));
 +    conv = csv_txn_test_field_string (info, amt);
 +    result = g_strconcat (so_far, conv, info->mid_sep, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Share Price / Conversion factor
 +static gchar*
 +add_rate (gchar *so_far, Split *split, gboolean t_void, CsvExportInfo *info)
 +{
 +    const gchar *amt;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    if (t_void)
 +        amt = xaccPrintAmount (gnc_numeric_zero(), gnc_split_amount_print_info (split, FALSE));
 +    else
 +        amt = xaccPrintAmount (xaccSplitGetSharePrice (split), gnc_split_amount_print_info (split, FALSE));
 +
 +    conv = csv_txn_test_field_string (info, amt);
 +    result = g_strconcat (so_far, conv, info->end_sep, EOLSTR, NULL);
 +    g_free (conv);
 +    g_free (so_far);
 +    return result;
 +}
 +
 +// Share Price / Conversion factor
 +static gchar*
 +add_price (gchar *so_far, Split *split, gboolean t_void, CsvExportInfo *info)
 +{
 +    const gchar *string_amount;
 +    gchar       *conv;
 +    gchar       *result;
 +
 +    if (t_void)
 +    {
 +        gnc_numeric cf = gnc_numeric_div (xaccSplitVoidFormerValue (split), xaccSplitVoidFormerAmount (split), GNC_DENOM_AUTO,
 +                                                   GNC_HOW_DENOM_SIGFIGS(6) | GNC_HOW_RND_ROUND_HALF_UP);
 +        string_amount = xaccPrintAmount (cf, gnc_split_amount_print_info (split, FALSE));
 +    }
 +    else
 +        string_amount = xaccPrintAmount (xaccSplitGetSharePrice (split), gnc_split_amount_print_info (split, FALSE));
 +
 +    conv = csv_txn_test_field_string (info, string_amount);
 +    result = g_strconcat (so_far, conv, info->end_sep, EOLSTR, NULL);
 +    g_free (conv);
 +    return result;
 +}
 +
 +/******************************************************************************/
 +
 +static gchar*
 +make_simple_trans_line (Account *acc, Transaction *trans, Split *split, CsvExportInfo *info)
 +{
 +    gboolean t_void = xaccTransGetVoidStatus (trans);
 +
 +    gchar *exp_line = g_strdup("");
 +    exp_line = add_date (exp_line, trans, info);
 +    exp_line = add_account_name (exp_line, split, TRUE, info);
 +    exp_line = add_number (exp_line, trans, info);
 +    exp_line = add_description (exp_line, trans, info);
 +    exp_line = add_category (exp_line, split, TRUE, info);
 +    exp_line = add_reconcile (exp_line, split, info);
 +    exp_line = add_amount (exp_line, split, t_void, TRUE, info);
 +    exp_line = add_amount (exp_line, split, t_void, FALSE, info);
 +    exp_line = add_rate (exp_line, split, t_void, info);
 +    return exp_line;
 +}
 +
 +static gchar*
 +make_split_part (gchar* exp_line, Split *split, gboolean t_void, CsvExportInfo *info)
 +{
 +    exp_line = add_action (exp_line, split, info);
 +    exp_line = add_memo (exp_line, split, info);
 +    exp_line = add_account_name (exp_line, split, TRUE, info);
 +    exp_line = add_account_name (exp_line, split, FALSE, info);
 +    exp_line = add_amount (exp_line, split, t_void, TRUE, info);
 +    exp_line = add_amount (exp_line, split, t_void, FALSE, info);
 +    exp_line = add_reconcile (exp_line, split, info);
 +    exp_line = add_reconcile_date (exp_line, split, info);
 +    exp_line = add_price (exp_line, split, t_void, info);
 +    return exp_line;
 +}
 +
 +static gchar*
 +make_complex_trans_line (Account *acc, Transaction *trans, Split *split, CsvExportInfo *info)
 +{
 +    gchar *exp_line = g_strdup("");
 +    exp_line = add_date (exp_line, trans, info);
 +    exp_line = add_guid (exp_line, trans, info);
 +    exp_line = add_number (exp_line, trans, info);
 +    exp_line = add_description (exp_line, trans, info);
 +    exp_line = add_notes (exp_line, trans, info);
 +    exp_line = add_commodity (exp_line, trans, info);
 +    exp_line = add_void_reason (exp_line, trans, info);
 +    return make_split_part (exp_line, split, xaccTransGetVoidStatus (trans), info);
 +}
 +
 +static gchar*
 +make_complex_split_line (Transaction *trans, Split *split, CsvExportInfo *info)
 +{
 +    /* Pure split lines don't have any transaction information,
 +     * so start with empty fields for all transaction columns.
 +     */
 +    gchar *result = g_strconcat (info->end_sep, info->mid_sep, info->mid_sep, info->mid_sep,
 +            info->mid_sep, info->mid_sep, info->mid_sep, info->mid_sep, NULL);
 +    return make_split_part (result, split, xaccTransGetVoidStatus (trans), info);
 +}
 +
 +
 +/*******************************************************
 + * account_splits
 + *
 + * gather the splits / transactions for an account and
 + * send them to a file
 + *******************************************************/
 +static
 +void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
 +{
 +    GSList  *p1, *p2;
 +    GList   *splits;
 +    QofBook *book;
 +
 +    // Setup the query for normal transaction export
 +    if (info->export_type == XML_EXPORT_TRANS)
 +    {
 +        info->query = qof_query_create_for (GNC_ID_SPLIT);
 +        book = gnc_get_current_book();
 +        qof_query_set_book (info->query, book);
 +
 +        /* Sort by transaction date */
 +        p1 = g_slist_prepend (NULL, TRANS_DATE_POSTED);
 +        p1 = g_slist_prepend (p1, SPLIT_TRANS);
 +        p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
 +        qof_query_set_sort_order (info->query, p1, p2, NULL);
 +
 +        xaccQueryAddSingleAccountMatch (info->query, acc, QOF_QUERY_AND);
 +        xaccQueryAddDateMatchTT (info->query, TRUE, info->csvd.start_time, TRUE, info->csvd.end_time, QOF_QUERY_AND);
 +    }
 +
 +    /* Run the query */
 +    for (splits = qof_query_run (info->query); splits; splits = splits->next)
 +    {
 +        Split       *split;
 +        Transaction *trans;
 +        SplitList   *s_list;
 +        GList       *node;
 +        Split       *t_split;
 +        int          nSplits;
 +        int          cnt;
 +        gchar       *line;
 +
 +        split = splits->data;
 +        trans = xaccSplitGetParent (split);
 +        nSplits = xaccTransCountSplits (trans);
 +        s_list = xaccTransGetSplitList (trans);
 +
 +        // Look for trans already exported in trans_list
 +        if (g_list_find (info->trans_list, trans) != NULL)
 +            continue;
 +
 +        // Look for blank split
 +        if (xaccSplitGetAccount (split) == NULL)
 +            continue;
 +
 +        // This will be a simple layout equivalent to a single line register view.
 +        if (info->simple_layout)
 +        {
 +            line = make_simple_trans_line (acc, trans, split, info);
 +
 +            /* Write to file */
 +            if (!write_line_to_file (fh, line))
 +            {
 +                info->failed = TRUE;
 +                break;
 +            }
 +            g_free (line);
 +            continue;
 +        }
 +
 +        // Complex Transaction Line.
 +        line = make_complex_trans_line (acc, trans, split, info);
 +
 +        /* Write to file */
 +        if (!write_line_to_file (fh, line))
 +        {
 +            info->failed = TRUE;
 +            break;
 +        }
 +        g_free (line);
 +
 +        /* Loop through the list of splits for the Transaction */
 +        node = s_list;
 +        cnt = 0;
 +        while ((cnt < nSplits) && (info->failed == FALSE))
 +        {
 +            t_split = node->data;
 +
 +            // base split is already written on the trans_line
 +            if (split != t_split)
 +            {
 +            // Complex Split Line.
 +                line = make_complex_split_line (trans, t_split, info);
 +
 +                if (!write_line_to_file (fh, line))
 +                    info->failed = TRUE;
 +
 +                g_free (line);
 +            }
 +
 +            cnt++;
 +            node = node->next;
 +        }
 +        info->trans_list = g_list_prepend (info->trans_list, trans); // add trans to trans_list
 +    }
 +    if (info->export_type == XML_EXPORT_TRANS)
 +        qof_query_destroy (info->query);
 +    g_list_free (splits);
 +}
 +
 +
 +/*******************************************************
 + * csv_transactions_export
 + *
 + * write a list of transactions to a text file
 + *******************************************************/
 +void csv_transactions_export (CsvExportInfo *info)
 +{
 +    FILE    *fh;
 +    Account *acc;
 +    GList   *ptr;
 +    gboolean num_action = qof_book_use_split_action_for_num_field (gnc_get_current_book());
 +
 +    ENTER("");
 +    DEBUG("File name is : %s", info->file_name);
 +
 +    info->failed = FALSE;
 +
 +    /* Set up separators */
 +    if (info->use_quotes)
 +    {
 +        info->end_sep = "\"";
 +        info->mid_sep = g_strconcat ("\"", info->separator_str, "\"", NULL);
 +    }
 +    else
 +    {
 +        info->end_sep = "";
 +        info->mid_sep = g_strconcat (info->separator_str, NULL);
 +    }
 +
 +    /* Open File for writing */
 +    fh = g_fopen (info->file_name, "w" );
 +    if (fh != NULL)
 +    {
 +        gchar *header;
 +        int i;
 +
 +        /* Header string */
 +        if (info->simple_layout)
 +        {
-             header = g_strconcat (info->end_sep, _("Date"), info->mid_sep, _("Account Name"),
++            header = g_strconcat (info->end_sep,
++                         /* Translators: The following symbols will build the *
++                          * header line of exported CSV files:                */
++                                  _("Date"), info->mid_sep, _("Account Name"),
 +                                  info->mid_sep, (num_action ? _("Transaction Number") : _("Number")),
 +                                  info->mid_sep, _("Description"), info->mid_sep, _("Full Category Path"),
 +                                  info->mid_sep, _("Reconcile"), info->mid_sep, _("Amount With Sym"),
 +                                  info->mid_sep, _("Amount Num."), info->mid_sep, _("Rate/Price"),
 +                                  info->end_sep, EOLSTR, NULL);
 +        }
 +        else
 +        {
 +            header = g_strconcat (info->end_sep, _("Date"), info->mid_sep, _("Transaction ID"),
 +                                  info->mid_sep, (num_action ? _("Transaction Number") : _("Number")),
 +                                  info->mid_sep, _("Description"), info->mid_sep, _("Notes"),
 +                                  info->mid_sep, _("Commodity/Currency"), info->mid_sep, _("Void Reason"),
 +                                  info->mid_sep, (num_action ? _("Number/Action") : _("Action")), info->mid_sep, _("Memo"),
 +                                  info->mid_sep, _("Full Account Name"), info->mid_sep, _("Account Name"),
 +                                  info->mid_sep, _("Amount With Sym"), info->mid_sep, _("Amount Num."),
 +                                  info->mid_sep, _("Reconcile"), info->mid_sep, _("Reconcile Date"), info->mid_sep, _("Rate/Price"),
 +                                  info->end_sep, EOLSTR, NULL);
 +        }
 +        DEBUG("Header String: %s", header);
 +
 +        /* Write header line */
 +        if (!write_line_to_file (fh, header))
 +        {
 +            info->failed = TRUE;
 +            g_free (header);
 +            return;
 +        }
 +        g_free (header);
 +
 +        if (info->export_type == XML_EXPORT_TRANS)
 +        {
 +            /* Go through list of accounts */
 +            for (ptr = info->csva.account_list, i = 0; ptr; ptr = g_list_next(ptr), i++)
 +            {
 +                acc = ptr->data;
 +                DEBUG("Account being processed is : %s", xaccAccountGetName (acc));
 +                account_splits (info, acc, fh);
 +            }
 +        }
 +        else
 +            account_splits (info, info->account, fh);
 +
 +        g_list_free (info->trans_list); // free trans_list
 +    }
 +    else
 +        info->failed = TRUE;
 +    if (fh)
 +        fclose (fh);
 +    LEAVE("");
 +}
 +
diff --cc gnucash/import-export/dialog-import.glade
index 05a03da9,0000000..96c39c0
mode 100644,000000..100644
--- a/gnucash/import-export/dialog-import.glade
+++ b/gnucash/import-export/dialog-import.glade
@@@ -1,1206 -1,0 +1,1208 @@@
++<?xml version="1.0" encoding="utf-8"?>
++<?xml version="1.0" encoding="utf-8"?>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!-- Generated with glade 3.20.0 -->
 +<interface>
 +  <requires lib="gtk+" version="3.10"/>
 +  <object class="GtkBox" id="account_picker_content">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="orientation">vertical</property>
 +    <child>
 +      <object class="GtkLabel" id="label847715">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="label" translatable="yes">Please select or create an appropriate GnuCash account for:</property>
 +        <property name="justify">center</property>
 +      </object>
 +      <packing>
 +        <property name="expand">False</property>
 +        <property name="fill">False</property>
 +        <property name="position">0</property>
 +      </packing>
 +    </child>
 +    <child>
 +      <object class="GtkLabel" id="online_id_label">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="label" translatable="yes">Online account ID here...</property>
 +        <property name="justify">center</property>
 +      </object>
 +      <packing>
 +        <property name="expand">False</property>
 +        <property name="fill">False</property>
 +        <property name="position">1</property>
 +      </packing>
 +    </child>
 +    <child>
 +      <object class="GtkScrolledWindow" id="account_tree_sw">
 +        <property name="visible">True</property>
 +        <property name="can_focus">True</property>
 +        <child>
 +          <placeholder/>
 +        </child>
 +      </object>
 +      <packing>
 +        <property name="expand">True</property>
 +        <property name="fill">True</property>
 +        <property name="position">2</property>
 +      </packing>
 +    </child>
 +  </object>
 +  <object class="GtkDialog" id="account_picker_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">Select Account</property>
 +    <property name="default_width">800</property>
 +    <property name="default_height">600</property>
 +    <property name="type_hint">dialog</property>
 +    <signal name="map" handler="gnc_ui_generic_account_picker_map_cb" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="account_picker_vbox">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area8">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="newbutton">
 +                <property name="label">gnc-new-account</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="cancelbutton">
 +                <property name="label">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="okbutton">
 +                <property name="label">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">False</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="1">newbutton</action-widget>
 +      <action-widget response="-6">cancelbutton</action-widget>
 +      <action-widget response="-5">okbutton</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkAdjustment" id="atm_fee_adj">
 +    <property name="upper">1000</property>
 +    <property name="value">2</property>
 +    <property name="step_increment">0.01</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="auto_add_adj">
 +    <property name="lower">1</property>
 +    <property name="upper">6</property>
 +    <property name="value">1</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkAdjustment" id="auto_clear_adj">
 +    <property name="lower">6</property>
 +    <property name="upper">12</property>
 +    <property name="value">6</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkDialog" id="format_picker_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">Choose a format</property>
 +    <property name="resizable">False</property>
 +    <property name="modal">True</property>
 +    <property name="default_width">600</property>
 +    <property name="default_height">400</property>
 +    <property name="type_hint">dialog</property>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox16">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area16">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="okbutton1">
 +                <property name="label">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkFrame" id="frame2">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="label_xalign">0</property>
 +            <child>
 +              <object class="GtkBox" id="vbox8">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="spacing">15</property>
 +                <child>
 +                  <object class="GtkLabel" id="msg_label">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="label">do not translate</property>
 +                    <property name="justify">center</property>
 +                    <property name="wrap">True</property>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">False</property>
 +                    <property name="fill">False</property>
 +                    <property name="position">0</property>
 +                  </packing>
 +                </child>
 +                <child>
 +                  <object class="GtkBox" id="hbox1">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="spacing">3</property>
 +                    <child>
 +                      <object class="GtkLabel" id="label847775">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <property name="label" translatable="yes">Format:</property>
 +                        <property name="justify">right</property>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">False</property>
 +                        <property name="fill">False</property>
 +                        <property name="position">0</property>
 +                      </packing>
 +                    </child>
 +                    <child>
 +                      <object class="GtkBox" id="menu_box">
 +                        <property name="visible">True</property>
 +                        <property name="can_focus">False</property>
 +                        <child>
 +                          <placeholder/>
 +                        </child>
 +                      </object>
 +                      <packing>
 +                        <property name="expand">True</property>
 +                        <property name="fill">True</property>
 +                        <property name="position">1</property>
 +                      </packing>
 +                    </child>
 +                  </object>
 +                  <packing>
 +                    <property name="expand">True</property>
 +                    <property name="fill">True</property>
 +                    <property name="position">1</property>
 +                  </packing>
 +                </child>
 +              </object>
 +            </child>
 +            <child type="label">
 +              <object class="GtkLabel" id="label847773">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">Choose a format</property>
 +              </object>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-5">okbutton1</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkAdjustment" id="match_adj">
 +    <property name="upper">6</property>
 +    <property name="value">1</property>
 +    <property name="step_increment">1</property>
 +    <property name="page_increment">10</property>
 +  </object>
 +  <object class="GtkWindow" id="Preferences">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">Preferences</property>
 +    <child>
 +      <object class="GtkGrid" id="matcher_prefs">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <child>
 +          <object class="GtkCheckButton" id="pref/dialogs.import.generic/enable-skip">
-             <property name="label" translatable="yes">Enable skip transaction action</property>
++            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Enable skip transaction action</property>
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="receives_default">False</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">Enable the SKIP action in the transaction matcher. If enabled, a transaction whose best match&apos;s score is in the yellow zone (above the Auto-ADD threshold but below the Auto-CLEAR threshold) will be skipped by default.</property>
 +            <property name="tooltip_text" translatable="yes">Enable the SKIP action in the transaction matcher. If enabled, a transaction whose best match's score is in the yellow zone (above the Auto-ADD threshold but below the Auto-CLEAR threshold) will be skipped by default.</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="use_underline">True</property>
 +            <property name="draw_indicator">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">1</property>
 +            <property name="width">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkCheckButton" id="pref/dialogs.import.generic/enable-update">
-             <property name="label" translatable="yes">Enable update match action</property>
++            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Enable update match action</property>
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="receives_default">False</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">Enable the UPDATE AND RECONCILE action in the transaction matcher. If enabled, a transaction whose best match&apos;s score is above the Auto-CLEAR threshold and has a different date or amount than the matching existing transaction will cause the existing transaction to be updated and cleared by default.</property>
 +            <property name="tooltip_text" translatable="yes">Enable the UPDATE AND RECONCILE action in the transaction matcher. If enabled, a transaction whose best match's score is above the Auto-CLEAR threshold and has a different date or amount than the matching existing transaction will cause the existing transaction to be updated and cleared by default.</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="use_underline">True</property>
 +            <property name="draw_indicator">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">2</property>
 +            <property name="width">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="label847785">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="label" translatable="yes"><b>Generic Importer</b></property>
 +            <property name="use_markup">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">0</property>
 +            <property name="width">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkSpinButton" id="pref/dialogs.import.generic/atm-fee-threshold">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">In some places commercial ATMs (not belonging to a financial institution) are installed in places like convenience stores. These ATMs add their fee directly to the amount instead of showing up as a separate transaction or in your monthly banking fees. For example, you withdraw $100, and you are charged $101,50 plus Interac fees. If you manually entered that $100, the amounts won&apos;t match. You should set this to whatever is the maximum such fee in your area (in units of your local currency), so the transaction will be recognised as a match.</property>
 +            <property name="tooltip_text" translatable="yes">In some places commercial ATMs (not belonging to a financial institution) are installed in places like convenience stores. These ATMs add their fee directly to the amount instead of showing up as a separate transaction or in your monthly banking fees. For example, you withdraw $100, and you are charged $101,50 plus Interac fees. If you manually entered that $100, the amounts won't match. You should set this to whatever is the maximum such fee in your area (in units of your local currency), so the transaction will be recognised as a match.</property>
 +            <property name="invisible_char">●</property>
 +            <property name="primary_icon_activatable">False</property>
 +            <property name="secondary_icon_activatable">False</property>
 +            <property name="adjustment">atm_fee_adj</property>
 +            <property name="climb_rate">1</property>
 +            <property name="digits">2</property>
 +            <property name="snap_to_ticks">True</property>
 +            <property name="numeric">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">1</property>
 +            <property name="top_attach">7</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkSpinButton" id="pref/dialogs.import.generic/auto-clear-threshold">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">A transaction whose best match&apos;s score is in the green zone (above or equal to the Auto-CLEAR threshold) will be CLEARed by default.</property>
 +            <property name="tooltip_text" translatable="yes">A transaction whose best match's score is in the green zone (above or equal to the Auto-CLEAR threshold) will be CLEARed by default.</property>
 +            <property name="invisible_char">●</property>
 +            <property name="primary_icon_activatable">False</property>
 +            <property name="secondary_icon_activatable">False</property>
 +            <property name="adjustment">auto_clear_adj</property>
 +            <property name="climb_rate">1</property>
 +            <property name="snap_to_ticks">True</property>
 +            <property name="numeric">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">1</property>
 +            <property name="top_attach">6</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkSpinButton" id="pref/dialogs.import.generic/auto-add-threshold">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">A transaction whose best match&apos;s score is in the red zone (above the display threshold but below or equal to the Auto-ADD threshold) will be ADDed by default.</property>
 +            <property name="tooltip_text" translatable="yes">A transaction whose best match's score is in the red zone (above the display threshold but below or equal to the Auto-ADD threshold) will be ADDed by default.</property>
 +            <property name="invisible_char">●</property>
 +            <property name="primary_icon_activatable">False</property>
 +            <property name="secondary_icon_activatable">False</property>
 +            <property name="adjustment">auto_add_adj</property>
 +            <property name="climb_rate">1</property>
 +            <property name="snap_to_ticks">True</property>
 +            <property name="numeric">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">1</property>
 +            <property name="top_attach">5</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkSpinButton" id="pref/dialogs.import.generic/match-threshold">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">The minimum score a potential match must have to be displayed in the match list.</property>
 +            <property name="tooltip_text" translatable="yes">The minimum score a potential match must have to be displayed in the match list.</property>
 +            <property name="invisible_char">●</property>
 +            <property name="primary_icon_activatable">False</property>
 +            <property name="secondary_icon_activatable">False</property>
 +            <property name="adjustment">match_adj</property>
 +            <property name="climb_rate">1</property>
 +            <property name="snap_to_ticks">True</property>
 +            <property name="numeric">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">1</property>
 +            <property name="top_attach">4</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="label847789">
 +            <property name="visible">True</property>
-             <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="label" translatable="yes">Commercial ATM _fees threshold</property>
++            <property name="label" translatable="yes">Commercial ATM _fees threshold</property>
 +            <property name="use_underline">True</property>
 +            <property name="mnemonic_widget">pref/dialogs.import.generic/atm-fee-threshold</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">7</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="label847788">
 +            <property name="visible">True</property>
-             <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="label" translatable="yes">Auto-c_lear threshold</property>
++            <property name="label" translatable="yes">Auto-c_lear threshold</property>
 +            <property name="use_underline">True</property>
 +            <property name="mnemonic_widget">pref/dialogs.import.generic/auto-clear-threshold</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">6</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="label847787">
 +            <property name="visible">True</property>
-             <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="label" translatable="yes">Auto-_add threshold</property>
++            <property name="label" translatable="yes">Auto-_add threshold</property>
 +            <property name="use_underline">True</property>
 +            <property name="mnemonic_widget">pref/dialogs.import.generic/auto-add-threshold</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">5</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkLabel" id="label847786">
 +            <property name="visible">True</property>
-             <property name="can_focus">False</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="label" translatable="yes">Match _display threshold</property>
++            <property name="label" translatable="yes">Match _display threshold</property>
 +            <property name="use_underline">True</property>
 +            <property name="mnemonic_widget">pref/dialogs.import.generic/match-threshold</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">4</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkCheckButton" id="pref/dialogs.import.generic/use-bayes">
-             <property name="label" translatable="yes">Use _bayesian matching</property>
++            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Use _bayesian matching</property>
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="receives_default">False</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">Use bayesian algorithms to match new transactions with existing accounts.</property>
 +            <property name="tooltip_text" translatable="yes">Use bayesian algorithms to match new transactions with existing accounts.</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="use_underline">True</property>
 +            <property name="draw_indicator">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">3</property>
 +            <property name="width">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkCheckButton" id="pref/dialogs.import.generic/auto-create-commodity">
-             <property name="label" translatable="yes">Automatically create new commodities</property>
++            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Automatically create new commodities</property>
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="receives_default">False</property>
 +            <property name="has_tooltip">True</property>
 +            <property name="tooltip_markup">Enables the automatic creation of new commodities if any unknown commodity is encountered during import. Otherwise the user will be asked what to do with each unknown commodity.</property>
 +            <property name="tooltip_text" translatable="yes">Enables the automatic creation of new commodities if any unknown commodity is encountered during import. Otherwise the user will be asked what to do with each unknown commodity.</property>
 +            <property name="halign">start</property>
 +            <property name="margin_left">12</property>
 +            <property name="draw_indicator">True</property>
 +          </object>
 +          <packing>
 +            <property name="left_attach">0</property>
 +            <property name="top_attach">9</property>
 +            <property name="width">2</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +      </object>
 +    </child>
 +  </object>
 +  <object class="GtkDialog" id="match_picker_dialog">
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">Select matching existing transaction</property>
 +    <property name="default_width">600</property>
 +    <property name="default_height">400</property>
 +    <property name="type_hint">dialog</property>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox14">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <property name="spacing">8</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area14">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkCheckButton" id="hide_reconciled_check1">
-                 <property name="label" translatable="yes">Show Reconciled</property>
++                <property name="label" translatable="yes" comments="Dialog Select matching transactions">Show Reconciled</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="receives_default">False</property>
 +                <property name="active">True</property>
 +                <property name="draw_indicator">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">True</property>
 +                <property name="fill">True</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="cancel_button1">
 +                <property name="label">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="ok_button1">
 +                <property name="label">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkBox" id="vbox7">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="orientation">vertical</property>
 +            <child>
 +              <object class="GtkLabel" id="label847772">
 +                <property name="visible">True</property>
-                 <property name="can_focus">False</property>
++                <property name="label" translatable="yes">Imported transaction's first split:</property>
 +                <property name="label" translatable="yes">Imported transaction's first split:</property>
 +                <property name="justify">center</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow30">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTreeView" id="download_view">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="rules_hint">True</property>
 +                    <child internal-child="selection">
 +                      <object class="GtkTreeSelection" id="treeview-selection1"/>
 +                    </child>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="expand">True</property>
 +                <property name="fill">True</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847766">
 +                <property name="visible">True</property>
-                 <property name="can_focus">False</property>
++                <property name="label" translatable="yes">Potential splits matching the selected transaction: </property>
 +                <property name="label" translatable="yes">Potential splits matching the selected transaction: </property>
 +                <property name="justify">center</property>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow29">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTreeView" id="matched_view">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="rules_hint">True</property>
 +                    <child internal-child="selection">
 +                      <object class="GtkTreeSelection" id="treeview-selection2"/>
 +                    </child>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="expand">True</property>
 +                <property name="fill">True</property>
 +                <property name="position">3</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">cancel_button1</action-widget>
 +      <action-widget response="-5">ok_button1</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkTextBuffer" id="textbuffer2">
 +    <property name="text" translatable="yes">This transaction probably requires your intervention or it will be imported unbalanced.</property>
 +  </object>
 +  <object class="GtkTextBuffer" id="textbuffer3">
 +    <property name="text" translatable="yes">This transaction will be imported balanced (you may still want to double check the match or destination account).</property>
 +  </object>
 +  <object class="GtkTextBuffer" id="textbuffer4">
 +    <property name="text" translatable="yes">This transaction requires your intervention or it will NOT be imported.</property>
 +  </object>
 +  <object class="GtkTextBuffer" id="textbuffer5">
 +    <property name="text" translatable="yes">Double click on the transaction to change the matching transaction to reconcile, or the destination account of the auto-balance split (if required).</property>
 +  </object>
 +  <object class="GtkDialog" id="matcher_help_dialog">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="border_width">12</property>
 +    <property name="title" translatable="yes">Transaction List Help</property>
 +    <property name="resizable">False</property>
 +    <property name="type_hint">dialog</property>
 +    <signal name="close" handler="on_matcher_help_close_clicked" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="dialog-vbox18">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area18">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="matcher_help_close">
 +                <property name="label">_Close</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +                <signal name="clicked" handler="on_matcher_help_close_clicked" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <object class="GtkGrid" id="table1">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="row_spacing">6</property>
 +            <property name="column_spacing">12</property>
 +            <child>
 +              <object class="GtkLabel" id="label847790">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes"><b>Colors</b></property>
 +                <property name="use_markup">True</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">0</property>
 +                <property name="width">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow33">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="hscrollbar_policy">never</property>
 +                <property name="vscrollbar_policy">never</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTextView" id="textview3">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="pixels_above_lines">5</property>
 +                    <property name="pixels_below_lines">5</property>
 +                    <property name="editable">False</property>
 +                    <property name="wrap_mode">word</property>
 +                    <property name="left_margin">5</property>
 +                    <property name="right_margin">5</property>
 +                    <property name="cursor_visible">False</property>
 +                    <property name="buffer">textbuffer3</property>
 +                    <property name="accepts_tab">False</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">3</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow34">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="hscrollbar_policy">never</property>
 +                <property name="vscrollbar_policy">never</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTextView" id="textview4">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="pixels_above_lines">5</property>
 +                    <property name="pixels_below_lines">5</property>
 +                    <property name="editable">False</property>
 +                    <property name="wrap_mode">word</property>
 +                    <property name="left_margin">5</property>
 +                    <property name="right_margin">5</property>
 +                    <property name="cursor_visible">False</property>
 +                    <property name="buffer">textbuffer4</property>
 +                    <property name="accepts_tab">False</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow32">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="hscrollbar_policy">never</property>
 +                <property name="vscrollbar_policy">never</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTextView" id="textview2">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="pixels_above_lines">5</property>
 +                    <property name="pixels_below_lines">5</property>
 +                    <property name="editable">False</property>
 +                    <property name="wrap_mode">word</property>
 +                    <property name="left_margin">5</property>
 +                    <property name="right_margin">5</property>
 +                    <property name="cursor_visible">False</property>
 +                    <property name="buffer">textbuffer2</property>
 +                    <property name="accepts_tab">False</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847794">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">4</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847795">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes"><b>Actions</b></property>
 +                <property name="use_markup">True</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">5</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847796">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">"A"</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">6</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847797">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">"U+R"</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">7</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847798">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">"R"</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">8</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847799">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Select "A" to add the transaction as new.</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">6</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847780">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Select "U+R" to update and reconcile a matching transaction.</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">7</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847781">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Select "R" to reconcile a matching transaction.</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">8</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847800">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="halign">start</property>
 +                <property name="label" translatable="yes">Select neither to skip the transaction (it won't be imported at all).</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">1</property>
 +                <property name="top_attach">9</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkLabel" id="label847801">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <property name="label" translatable="yes">(none)</property>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">9</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkScrolledWindow" id="scrolledwindow35">
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="vexpand">True</property>
 +                <property name="hscrollbar_policy">never</property>
 +                <property name="vscrollbar_policy">never</property>
 +                <property name="shadow_type">in</property>
 +                <child>
 +                  <object class="GtkTextView" id="textview5">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">True</property>
 +                    <property name="pixels_above_lines">5</property>
 +                    <property name="pixels_below_lines">5</property>
 +                    <property name="editable">False</property>
 +                    <property name="wrap_mode">word</property>
 +                    <property name="left_margin">5</property>
 +                    <property name="right_margin">5</property>
 +                    <property name="cursor_visible">False</property>
 +                    <property name="buffer">textbuffer5</property>
 +                    <property name="accepts_tab">False</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">10</property>
 +                <property name="width">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkEventBox" id="intervention_required_box">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <child>
 +                  <object class="GtkLabel" id="label847802">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="label" translatable="yes">Red</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkEventBox" id="intervention_probably_required_box">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <child>
 +                  <object class="GtkLabel" id="label847803">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="label" translatable="yes">Yellow</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">2</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkEventBox" id="intervention_not_required_box">
 +                <property name="visible">True</property>
 +                <property name="can_focus">False</property>
 +                <child>
 +                  <object class="GtkLabel" id="label847804">
 +                    <property name="visible">True</property>
 +                    <property name="can_focus">False</property>
 +                    <property name="label" translatable="yes">Green</property>
 +                  </object>
 +                </child>
 +              </object>
 +              <packing>
 +                <property name="left_attach">0</property>
 +                <property name="top_attach">3</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <placeholder/>
 +            </child>
 +            <child>
 +              <placeholder/>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">True</property>
 +            <property name="fill">True</property>
 +            <property name="position">2</property>
 +          </packing>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-7">matcher_help_close</action-widget>
 +    </action-widgets>
 +  </object>
 +  <object class="GtkBox" id="transaction_matcher_content">
 +    <property name="visible">True</property>
 +    <property name="can_focus">False</property>
 +    <property name="orientation">vertical</property>
 +    <child>
 +      <object class="GtkLabel" id="heading_label">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="label" translatable="yes">List of downloaded transactions (source split shown):</property>
 +        <property name="justify">center</property>
 +      </object>
 +      <packing>
 +        <property name="expand">False</property>
 +        <property name="fill">False</property>
 +        <property name="position">0</property>
 +      </packing>
 +    </child>
 +    <child>
 +      <object class="GtkScrolledWindow" id="scrolledwindow25">
 +        <property name="visible">True</property>
 +        <property name="can_focus">True</property>
 +        <property name="shadow_type">in</property>
 +        <child>
 +          <object class="GtkTreeView" id="downloaded_view">
 +            <property name="visible">True</property>
 +            <property name="can_focus">True</property>
 +            <property name="reorderable">True</property>
 +            <property name="rules_hint">True</property>
 +            <property name="enable_search">False</property>
 +            <child internal-child="selection">
 +              <object class="GtkTreeSelection" id="treeview-selection3"/>
 +            </child>
 +          </object>
 +        </child>
 +      </object>
 +      <packing>
 +        <property name="expand">True</property>
 +        <property name="fill">True</property>
 +        <property name="position">1</property>
 +      </packing>
 +    </child>
 +    <child>
 +      <placeholder/>
 +    </child>
 +  </object>
 +  <object class="GtkDialog" id="transaction_matcher_dialog">
 +    <property name="can_focus">False</property>
 +    <property name="title" translatable="yes">Generic import transaction matcher</property>
 +    <property name="default_width">600</property>
 +    <property name="default_height">400</property>
 +    <property name="type_hint">dialog</property>
 +    <signal name="close" handler="on_matcher_cancel_clicked" swapped="no"/>
 +    <child internal-child="vbox">
 +      <object class="GtkBox" id="transaction_matcher_vbox">
 +        <property name="visible">True</property>
 +        <property name="can_focus">False</property>
 +        <property name="orientation">vertical</property>
 +        <child internal-child="action_area">
 +          <object class="GtkButtonBox" id="dialog-action_area10">
 +            <property name="visible">True</property>
 +            <property name="can_focus">False</property>
 +            <property name="layout_style">end</property>
 +            <child>
 +              <object class="GtkButton" id="matcher_cancel">
 +                <property name="label">_Cancel</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +                <signal name="clicked" handler="on_matcher_cancel_clicked" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">0</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="matcher_ok">
 +                <property name="label">_OK</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="has_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +                <signal name="clicked" handler="on_matcher_ok_clicked" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">1</property>
 +              </packing>
 +            </child>
 +            <child>
 +              <object class="GtkButton" id="matcher__help">
 +                <property name="label">_Help</property>
 +                <property name="visible">True</property>
 +                <property name="can_focus">True</property>
 +                <property name="can_default">True</property>
 +                <property name="receives_default">True</property>
 +                <property name="use_underline">True</property>
 +                <signal name="clicked" handler="on_matcher_help_clicked" swapped="no"/>
 +              </object>
 +              <packing>
 +                <property name="expand">False</property>
 +                <property name="fill">False</property>
 +                <property name="position">2</property>
 +              </packing>
 +            </child>
 +          </object>
 +          <packing>
 +            <property name="expand">False</property>
 +            <property name="fill">True</property>
 +            <property name="pack_type">end</property>
 +            <property name="position">0</property>
 +          </packing>
 +        </child>
 +        <child>
 +          <placeholder/>
 +        </child>
 +      </object>
 +    </child>
 +    <action-widgets>
 +      <action-widget response="-6">matcher_cancel</action-widget>
 +      <action-widget response="-5">matcher_ok</action-widget>
 +      <action-widget response="-11">matcher__help</action-widget>
 +    </action-widgets>
 +  </object>
 +</interface>
diff --cc gnucash/register/ledger-core/split-register-layout.c
index 151a413,0000000..1553d48
mode 100644,000000..100644
--- a/gnucash/register/ledger-core/split-register-layout.c
+++ b/gnucash/register/ledger-core/split-register-layout.c
@@@ -1,871 -1,0 +1,888 @@@
 +/********************************************************************\
 + * split-register-layout.c -- split register layout object          *
 + * Copyright (C) 1998 Linas Vepstas <linas at linas.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 <glib.h>
 +#include <glib/gi18n.h>
 +
 +#include "gnc-engine.h"
 +#include "split-register-layout.h"
 +
 +
 +/* This static indicates the debugging module that this .o belongs to.  */
 +static QofLogModule log_module = GNC_MOD_REGISTER;
 +
 +
 +static void
 +gnc_register_add_cell (TableLayout *layout,
 +                       const char *cell_name,
 +                       const char *cell_type_name,
 +                       const char *sample_text,
 +                       CellAlignment alignment,
 +                       gboolean expandable,
 +                       gboolean span)
 +{
 +    BasicCell *cell;
 +
 +    g_return_if_fail (layout != NULL);
 +    g_return_if_fail (cell_type_name != NULL);
 +
 +    cell = gnc_register_make_cell (cell_type_name);
 +
 +    gnc_basic_cell_set_name (cell, cell_name);
 +    gnc_basic_cell_set_type_name (cell, cell_type_name);
 +    gnc_basic_cell_set_sample_text (cell, sample_text);
 +    gnc_basic_cell_set_alignment (cell, alignment);
 +    gnc_basic_cell_set_expandable (cell, expandable);
 +    gnc_basic_cell_set_span (cell, span);
 +
 +    gnc_table_layout_add_cell (layout, cell);
 +}
 +
 +static void
 +copy_cursor_row (TableLayout *layout, CellBlock *to, CellBlock *from, int row)
 +{
 +    int col;
 +
 +    for (col = 0; col < from->num_cols; col++)
 +    {
 +        BasicCell *cell;
 +
 +        cell = gnc_cellblock_get_cell (from, row, col);
 +        if (!cell || !cell->cell_name)
 +            continue;
 +
 +        gnc_table_layout_set_cell (layout, to, cell->cell_name, row, col);
 +    }
 +}
 +
 +static void
 +gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
 +{
 +    CellBlock *curs;
 +    CellBlock *curs_last;
 +
 +    switch (reg->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:
 +    {
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_LEDGER);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL,  0, 4);
 +        if (reg->is_template)
 +        {
 +            gnc_table_layout_set_cell (layout, curs, FDEBT_CELL, 0, 5);
 +            gnc_table_layout_set_cell (layout, curs, FCRED_CELL, 0, 6);
 +        }
 +        else
 +        {
 +            gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 5);
 +            gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 6);
 +        }
 +        gnc_table_layout_set_cell (layout, curs, BALN_CELL,  0, 7);
 +        gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_JOURNAL);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 6);
 +        gnc_table_layout_set_cell (layout, curs, TBALN_CELL, 0, 7);
 +        gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SPLIT);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 1);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 2);
 +        gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL, 0, 4);
 +        if (reg->is_template)
 +        {
 +            gnc_table_layout_set_cell (layout, curs, FDEBT_CELL, 0, 5);
 +            gnc_table_layout_set_cell (layout, curs, FCRED_CELL, 0, 6);
 +        }
 +        else
 +        {
 +            gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 5);
 +            gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 6);
 +        }
 +        gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
 +
 +        break;
 +    }
 +    /* --------------------------------------------------------- */
 +
 +    case PAYABLE_REGISTER:
 +    case RECEIVABLE_REGISTER:
 +    {
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_LEDGER);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, TYPE_CELL,  0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DDUE_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 3);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 4);
 +        gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 6);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 7);
 +        gnc_table_layout_set_cell (layout, curs, BALN_CELL,  0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 3);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 3);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_JOURNAL);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, TYPE_CELL,  0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DDUE_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 3);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 4);
 +
 +        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 6);
 +        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 7);
 +        gnc_table_layout_set_cell (layout, curs, TBALN_CELL, 0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 3);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SPLIT);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 4);
 +        gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 6);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 7);
 +
 +        break;
 +    }
 +
 +    /* --------------------------------------------------------- */
 +    case INCOME_LEDGER:
 +    case GENERAL_JOURNAL:
 +    case SEARCH_LEDGER:
 +    {
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_LEDGER);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL,  0, 4);
 +        if (reg->is_template)
 +        {
 +            gnc_table_layout_set_cell (layout, curs, FDEBT_CELL,  0, 5);
 +            gnc_table_layout_set_cell (layout, curs, FCRED_CELL,  0, 6);
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,   0, 7);
 +        }
 +        else
 +        {
 +            gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 5);
 +            gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 6);
 +            gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,  0, 8);
 +        }
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_JOURNAL);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 6);
 +        if (reg->is_template)
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,  0, 7);
 +        else
 +        {
 +            gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,  0, 8);
 +        }
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SPLIT);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 1);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 2);
 +        gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL, 0, 4);
 +        if (reg->is_template)
 +        {
 +            gnc_table_layout_set_cell (layout, curs, FDEBT_CELL,  0, 5);
 +            gnc_table_layout_set_cell (layout, curs, FCRED_CELL,  0, 6);
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,   0, 7);
 +        }
 +        else
 +        {
 +            gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 5);
 +            gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 6);
 +            gnc_table_layout_set_cell (layout, curs, RATE_CELL,  0, 8);
 +        }
 +
 +        break;
 +    }
 +
 +    /* --------------------------------------------------------- */
 +    case STOCK_REGISTER:
 +    case CURRENCY_REGISTER:
 +    {
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_LEDGER);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0,  0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0,  1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0,  2);
 +        gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0,  3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL,  0,  4);
 +        gnc_table_layout_set_cell (layout, curs, SHRS_CELL,  0,  5);
 +        gnc_table_layout_set_cell (layout, curs, PRIC_CELL,  0,  6);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0,  7);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0,  8);
 +        gnc_table_layout_set_cell (layout, curs, BALN_CELL,  0,  9);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_JOURNAL);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0,  0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0,  1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0,  2);
 +        gnc_table_layout_set_cell (layout, curs, TSHRS_CELL, 0,  5);
 +        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0,  7);
 +        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0,  8);
 +        gnc_table_layout_set_cell (layout, curs, TBALN_CELL, 0,  9);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SPLIT);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 1);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 2);
 +        gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL, 0, 4);
 +        gnc_table_layout_set_cell (layout, curs, SHRS_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, PRIC_CELL, 0, 6);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 7);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 8);
 +
 +        break;
 +    }
 +
 +    /* --------------------------------------------------------- */
 +    case PORTFOLIO_LEDGER:
 +    {
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_LEDGER);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, MXFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL,  0, 4);
 +        gnc_table_layout_set_cell (layout, curs, SHRS_CELL,  0, 5);
 +        gnc_table_layout_set_cell (layout, curs, PRIC_CELL,  0, 6);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL,  0, 7);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL,  0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SINGLE_JOURNAL);
 +
 +        gnc_table_layout_set_cell (layout, curs, DATE_CELL,  0, 0);
 +        gnc_table_layout_set_cell (layout, curs, NUM_CELL,   0, 1);
 +        gnc_table_layout_set_cell (layout, curs, DESC_CELL,  0, 2);
 +        gnc_table_layout_set_cell (layout, curs, TSHRS_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, TDEBT_CELL, 0, 7);
 +        gnc_table_layout_set_cell (layout, curs, TCRED_CELL, 0, 8);
 +
 +        curs_last = curs;
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +
 +        copy_cursor_row (layout, curs, curs_last, 0);
 +
 +        gnc_table_layout_set_cell (layout, curs, TNUM_CELL,  1, 1);
 +        gnc_table_layout_set_cell (layout, curs, NOTES_CELL, 1, 2);
 +        gnc_table_layout_set_cell (layout, curs, VNOTES_CELL, 1, 3);
 +        gnc_table_layout_set_cell (layout, curs, ASSOC_CELL,  1, 4);
 +
 +        curs = gnc_table_layout_get_cursor (layout,
 +                                            CURSOR_SPLIT);
 +
 +        gnc_table_layout_set_cell (layout, curs, ACTN_CELL, 0, 1);
 +        gnc_table_layout_set_cell (layout, curs, MEMO_CELL, 0, 2);
 +        gnc_table_layout_set_cell (layout, curs, XFRM_CELL, 0, 3);
 +        gnc_table_layout_set_cell (layout, curs, RECN_CELL, 0, 4);
 +        gnc_table_layout_set_cell (layout, curs, SHRS_CELL, 0, 5);
 +        gnc_table_layout_set_cell (layout, curs, PRIC_CELL, 0, 6);
 +        gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 7);
 +        gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 8);
 +
 +        break;
 +    }
 +
 +    /* --------------------------------------------------------- */
 +    default:
 +        PERR ("unknown register type %d \n", reg->type);
 +        break;
 +    }
 +}
 +
 +static void
 +gnc_split_register_layout_add_cursors (SplitRegister *reg,
 +                                       TableLayout *layout)
 +{
 +    CellBlock *cursor;
 +    int num_cols;
 +
 +    switch (reg->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:
 +        num_cols = 9;
 +        break;
 +
 +    case PAYABLE_REGISTER:
 +    case RECEIVABLE_REGISTER:
 +        num_cols = 9;
 +        break;
 +
 +    case INCOME_LEDGER:
 +    case GENERAL_JOURNAL:
 +    case SEARCH_LEDGER:
 +        if (reg->is_template)
 +            num_cols = 8;
 +        else
 +            num_cols = 9;
 +        break;
 +
 +    case STOCK_REGISTER:
 +    case CURRENCY_REGISTER:
 +        num_cols = 10;
 +        break;
 +
 +    case PORTFOLIO_LEDGER:
 +        num_cols = 9;
 +        break;
 +
 +    default:
 +        PERR("Bad register type");
 +        g_assert (FALSE);
 +        return;
 +    }
 +
 +    cursor = gnc_cellblock_new (1, num_cols, CURSOR_HEADER);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    /* cursors used in ledger mode */
 +    cursor = gnc_cellblock_new (1, num_cols, CURSOR_SINGLE_LEDGER);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    gnc_table_layout_set_primary_cursor (layout, cursor);
 +
 +    cursor = gnc_cellblock_new (2, num_cols, CURSOR_DOUBLE_LEDGER);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    cursor = gnc_cellblock_new (2, num_cols, CURSOR_DOUBLE_LEDGER_NUM_ACTN);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    /* cursors used for journal mode */
 +    cursor = gnc_cellblock_new (1, num_cols, CURSOR_SINGLE_JOURNAL);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    cursor = gnc_cellblock_new (2, num_cols, CURSOR_DOUBLE_JOURNAL);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    cursor = gnc_cellblock_new (2, num_cols, CURSOR_DOUBLE_JOURNAL_NUM_ACTN);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +
 +    cursor = gnc_cellblock_new (1, num_cols, CURSOR_SPLIT);
 +    gnc_table_layout_add_cursor (layout, cursor);
 +}
 +
 +static void
 +gnc_split_register_layout_add_cells (SplitRegister *reg,
 +                                     TableLayout *layout)
 +{
 +    gnc_register_add_cell (layout,
 +                           DATE_CELL,
 +                           DATE_CELL_TYPE_NAME,
++                           /* Translators: The 'sample:' items are
++                              strings which are not displayed, but only
++                              used to estimate widths. Please only
++                              translate the portion after the ':' and
++                              leave the rest ("sample:") as is. */
 +                           N_("sample:12/12/2000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           DDUE_CELL,
 +                           DATE_CELL_TYPE_NAME,
 +                           N_("sample:12/12/2000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           NUM_CELL,
 +                           NUM_CELL_TYPE_NAME,
 +                           /* Translators: The 'sample:' items are
 +                              strings which are not displayed, but only
 +                              used to estimate widths. Please only
 +                              translate the portion after the ':' and
 +                              leave the rest ("sample:") as is. */
 +                           N_("sample:99999") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TNUM_CELL,
 +                           BASIC_CELL_TYPE_NAME,
 +                           N_("sample:99999") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           DESC_CELL,
 +                           QUICKFILL_CELL_TYPE_NAME,
 +                           N_("sample:Description of a transaction") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           TRUE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           RATE_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           NULL,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           RECN_CELL,
 +                           RECN_CELL_TYPE_NAME,
-                            N_("Reconciled:R") + 11,
++	                          /* Translators: The abbreviation for 'Reconciled'
++	                              in the header row of the register. Please only
++	                              translate the portion after the ':' and
++	                              leave the rest ("Reconciled:") as is. */
++	                            N_("Reconciled:R") + 11,
 +                           CELL_ALIGN_CENTER,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           ASSOC_CELL,
 +                           RECN_CELL_TYPE_NAME,
++                           /* Translators: The abbreviation for 'Associate'
++                              in the header row of the register. Please only
++                              translate the portion after the ':' and
++                              leave the rest ("Associate:") as is. */
 +                           N_("Associate:A") + 10,
 +                           CELL_ALIGN_CENTER,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           BALN_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           XFRM_CELL,
 +                           COMBO_CELL_TYPE_NAME,
 +                           N_("Transfer"),
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           MXFRM_CELL,
 +                           COMBO_CELL_TYPE_NAME,
 +                           N_("sample:Expenses:Automobile:Gasoline") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           ACTN_CELL,
 +                           COMBO_CELL_TYPE_NAME,
 +                           N_("sample:Expenses:Automobile:Gasoline") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           MEMO_CELL,
 +                           QUICKFILL_CELL_TYPE_NAME,
 +                           N_("sample:Memo field sample text string") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           TRUE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           DEBT_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           CRED_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           SHRS_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    /* Price cell must come after shares cell, as its callback performs
 +     * a computation on the value set by the shares cell callback. */
 +    gnc_register_add_cell (layout,
 +                           PRIC_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TDEBT_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TCRED_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TSHRS_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TBALN_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           TYPE_CELL,
 +                           RECN_CELL_TYPE_NAME,
-                            N_("Type:T") + 5,
++	                          /* Translators: The abbreviation for 'Type'
++	                              in the header row of the register. Please only
++	                              translate the portion after the ':' and
++	                              leave the rest ("Type:") as is. */
++	                            N_("Type:T") + 5,
 +                           CELL_ALIGN_CENTER,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           NOTES_CELL,
 +                           QUICKFILL_CELL_TYPE_NAME,
 +                           N_("sample:Notes field sample text string") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           FALSE,
 +                           TRUE);
 +
 +    gnc_register_add_cell (layout,
 +                           VNOTES_CELL,
 +                           BASIC_CELL_TYPE_NAME,
 +                           N_("sample:No Particular Reason") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           TRUE);
 +
 +    gnc_register_add_cell (layout,
 +                           FCRED_CELL,
 +                           FORMULA_CELL_TYPE_NAME,
 +                           N_("sample:(x + 0.33 * y + (x+y) )") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           FDEBT_CELL,
 +                           FORMULA_CELL_TYPE_NAME,
 +                           N_("sample:(x + 0.33 * y + (x+y) )") + 7,
 +                           CELL_ALIGN_LEFT,
 +                           FALSE,
 +                           FALSE);
 +
 +    gnc_register_add_cell (layout,
 +                           RBALN_CELL,
 +                           PRICE_CELL_TYPE_NAME,
 +                           N_("sample:999,999.000") + 7,
 +                           CELL_ALIGN_RIGHT,
 +                           FALSE,
 +                           FALSE);
 +
 +}
 +
 +TableLayout *
 +gnc_split_register_layout_new (SplitRegister *reg)
 +{
 +    TableLayout *layout;
 +
 +    layout = gnc_table_layout_new ();
 +
 +    gnc_split_register_layout_add_cells (reg, layout);
 +    gnc_split_register_layout_add_cursors (reg, layout);
 +    gnc_split_register_set_cells (reg, layout);
 +
 +    return layout;
 +}
diff --cc libgnucash/backend/dbi/gnc-backend-dbi.cpp
index 4050046,0000000..9ea3723
mode 100644,000000..100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@@ -1,1225 -1,0 +1,1243 @@@
 +/********************************************************************
 + * gnc-backend-dbi.c: load and save data to SQL via libdbi          *
 + *                                                                  *
 + * 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                   *
 +\********************************************************************/
 +/** @file gnc-backend-dbi.c
 + *  @brief load and save data to SQL
 + *  @author Copyright (c) 2006-2008 Phil Longstaff <plongstaff at rogers.com>
 + *
 + * This file implements the top-level QofBackend API for saving/
 + * restoring data to/from an SQL db using libdbi
 + */
 +extern "C"
 +{
- #include <config.h>
++#include "config.h"
 +
 +#include <platform.h>
 +#ifdef __STRICT_ANSI__
 +#undef __STRICT_ANSI__
 +#define __STRICT_ANSI_UNSET__ 1
 +#endif
 +#ifdef _NO_OLDNAMES
 +#undef _NO_OLDNAMES
 +#endif
 +#ifdef _UWIN
 +#undef _UWIN
 +#endif
 +#if PLATFORM(WINDOWS)
 +#include <winsock2.h>
 +#include <windows.h>
 +#define __STDC_FORMAT_MACROS 1
 +#endif
 +
 +#include <inttypes.h>
 +#include <errno.h>
 +#include <glib.h>
 +#include <glib/gstdio.h>
 +
 +#include "qof.h"
 +#include "qofquery-p.h"
 +#include "qofquerycore-p.h"
 +#include "Account.h"
 +#include "TransLog.h"
 +#include "gnc-engine.h"
 +#include "SX-book.h"
 +#include "Recurrence.h"
 +
 +#include "gnc-uri-utils.h"
 +#include "gnc-filepath-utils.h"
 +#include <gnc-path.h>
 +#include "gnc-locale-utils.h"
 +
 +#include "gnc-prefs.h"
 +
 +#ifdef S_SPLINT_S
 +#include "splint-defs.h"
 +#endif
 +
 +}
 +#include <boost/regex.hpp>
 +#include <string>
 +#include <iomanip>
 +
 +#include <gnc-backend-prov.hpp>
 +#include "gnc-backend-dbi.h"
 +#include "gnc-backend-dbi.hpp"
 +
 +#include <gnc-sql-object-backend.hpp>
 +#include "gnc-dbisqlresult.hpp"
 +#include "gnc-dbisqlconnection.hpp"
 +
 +#if PLATFORM(WINDOWS)
 +#ifdef __STRICT_ANSI_UNSET__
 +#undef __STRICT_ANSI_UNSET__
 +#define __STRICT_ANSI__ 1
 +#endif
 +#endif
 +
 +#if LIBDBI_VERSION >= 900
 +#define HAVE_LIBDBI_R 1
 +#define HAVE_LIBDBI_TO_LONGLONG 1
 +static dbi_inst dbi_instance = nullptr;
 +#else
 +#define HAVE_LIBDBI_R 0
 +#define HAVE_LIBDBI_TO_LONGLONG 0
 +#endif
 +
 +#define TRANSACTION_NAME "trans"
 +
 +static QofLogModule log_module = G_LOG_DOMAIN;
 +
 +#define FILE_URI_TYPE "file"
 +#define FILE_URI_PREFIX (FILE_URI_TYPE "://")
 +#define SQLITE3_URI_TYPE "sqlite3"
 +#define SQLITE3_URI_PREFIX (SQLITE3_URI_TYPE "://")
 +#define PGSQL_DEFAULT_PORT 5432
 +
 +static void adjust_sql_options (dbi_conn connection);
 +static bool save_may_clobber_data (dbi_conn conn, const std::string& dbname);
 +
 +template <DbType Type>
 +class QofDbiBackendProvider : public QofBackendProvider
 +{
 +public:
 +    QofDbiBackendProvider (const char* name, const char* type) :
 +        QofBackendProvider {name, type} {}
 +    QofDbiBackendProvider(QofDbiBackendProvider&) = delete;
 +    QofDbiBackendProvider operator=(QofDbiBackendProvider&) = delete;
 +    QofDbiBackendProvider(QofDbiBackendProvider&&) = delete;
 +    QofDbiBackendProvider operator=(QofDbiBackendProvider&&) = delete;
 +    ~QofDbiBackendProvider () = default;
 +    QofBackend* create_backend(void)
 +    {
 +        return new GncDbiBackend<Type>(nullptr, nullptr);
 +    }
 +    bool type_check(const char* type) { return true; }
 +};
 +
 +/* ================================================================= */
 +/* ================================================================= */
 +struct UriStrings
 +{
 +    UriStrings() = default;
 +    UriStrings(const std::string& uri);
 +    ~UriStrings() = default;
 +    std::string basename() const noexcept;
 +    const char* dbname() const noexcept;
 +    std::string quote_dbname(DbType t) const noexcept;
 +    std::string m_protocol;
 +    std::string m_host;
 +    std::string m_dbname;
 +    std::string m_username;
 +    std::string m_password;
 +    std::string m_basename;
 +    int m_portnum;
 +};
 +
 +UriStrings::UriStrings(const std::string& uri)
 +{
 +    gchar *protocol, *host, *username, *password, *dbname;
 +    int portnum;
 +    gnc_uri_get_components(uri.c_str(), &protocol, &host, &portnum, &username,
 +                           &password, &dbname);
 +    m_protocol = std::string{protocol};
 +    m_host = std::string{host};
 +    m_dbname = std::string{dbname};
 +    if (username)
 +	m_username = std::string{username};
 +    if (password)
 +	m_password = std::string{password};
 +    m_portnum = portnum;
 +    g_free(protocol);
 +    g_free(host);
 +    g_free(username);
 +    g_free(password);
 +    g_free(dbname);
 +    
 +}
 +
 +std::string
 +UriStrings::basename() const noexcept
 +{
 +    return m_protocol + "_" + m_host + "_" + m_username + "_" + m_dbname;
 +}
 +
 +const char*
 +UriStrings::dbname() const noexcept
 +{
 +    return m_dbname.c_str();
 +}
 +
 +std::string
 +UriStrings::quote_dbname(DbType t) const noexcept
 +{
 +    if (m_dbname.empty())
 +        return "";
 +    const char quote = (t == DbType::DBI_MYSQL ? '`' : '"');
 +    std::string retval(1, quote);
 +    retval += m_dbname + quote;
 +    return retval;
 +}
 +
 +static void
 +set_options(dbi_conn conn, const PairVec& options)
 +{
 +    for (auto option : options)
 +    {
 +        auto opt = option.first.c_str();
 +        auto val = option.second.c_str();
 +        auto result = dbi_conn_set_option(conn, opt, val);
 +        if (result < 0)
 +        {
 +            const char *msg = nullptr;
 +            int err = dbi_conn_error(conn, &msg);
 +            PERR("Error setting %s option to %s: %s", opt, val, msg);
 +            throw std::runtime_error(msg);
 +        }
 +    }
 +}
 +
 +/**
 + * Sets standard db options in a dbi_conn.
 + *
 + * @param conn dbi_conn connection
 + * @param uri UriStrings containing the needed parameters.
 + * @return TRUE if successful, FALSE if error
 + */
 +template <DbType Type> bool
 +GncDbiBackend<Type>::set_standard_connection_options (dbi_conn conn,
 +                                                const UriStrings& uri)
 +
 +{
 +    gint result;
 +    PairVec options;
 +    options.push_back(std::make_pair("host", uri.m_host));
 +    options.push_back(std::make_pair("dbname", uri.m_dbname));
 +    options.push_back(std::make_pair("username", uri.m_username));
 +    options.push_back(std::make_pair("password", uri.m_password));
 +    options.push_back(std::make_pair("encoding", "UTF-8"));
 +    try
 +    {
 +        set_options(conn, options);
 +        auto result = dbi_conn_set_option_numeric(conn, "port", uri.m_portnum);
 +        if (result < 0)
 +        {
 +            const char *msg = nullptr;
 +            auto err = dbi_conn_error(conn, &msg);
 +            PERR("Error setting port option to %d: %s", uri.m_portnum, msg);
 +            throw std::runtime_error(msg);
 +        }
 +    }
 +    catch (std::runtime_error& err)
 +    {
 +        set_error (ERR_BACKEND_SERVER_ERR);
 +        return false;
 +    }
 +
 +    return true;
 +}
 +
 +template <DbType Type> void error_handler(void* conn, void* data);
 +void error_handler(void* conn, void* data);
 +
 +template <DbType Type> dbi_conn
 +GncDbiBackend<Type>::conn_setup (PairVec& options, UriStrings& uri)
 +{
 +    const char* dbstr = (Type == DbType::DBI_SQLITE ? "sqlite3" :
 +                         Type == DbType::DBI_MYSQL ? "mysql" : "pgsql");
 +#if HAVE_LIBDBI_R
 +    dbi_conn conn = nullptr;
 +    if (dbi_instance)
 +        conn = dbi_conn_new_r (dbstr, dbi_instance);
 +    else
 +        PERR ("Attempt to connect with an uninitialized dbi_instance");
 +#else
 +    auto conn = dbi_conn_new (dbstr);
 +#endif
 +
 +    if (conn == nullptr)
 +    {
 +        PERR ("Unable to create %s dbi connection", dbstr);
 +        set_error (ERR_BACKEND_BAD_URL);
 +	return nullptr;
 +    }
 +
 +    dbi_conn_error_handler (conn, error_handler<Type>, this);
 +    if (!uri.m_dbname.empty() &&
 +        !set_standard_connection_options(conn, uri))
 +    {
 +        dbi_conn_close(conn);
 +        return nullptr;
 +    }
 +    if(!options.empty())
 +    {
 +        try {
 +            set_options(conn, options);
 +        }
 +        catch (std::runtime_error& err)
 +        {
 +            dbi_conn_close(conn);
 +            set_error (ERR_BACKEND_SERVER_ERR);
 +            return nullptr;
 +        }
 +    }
 +
 +    return conn;
 +}
 +
 +template <DbType Type>bool
 +GncDbiBackend<Type>::create_database(dbi_conn conn, const char* db)
 +{
 +    const char *dbname;
 +    const char *dbcreate;
 +    if (Type == DbType::DBI_MYSQL)
 +    {
 +        dbname = "mysql";
 +        dbcreate = "CREATE DATABASE %s CHARACTER SET utf8";
 +    }
 +    else
 +    {
 +        dbname = "postgres";
 +        dbcreate = "CREATE DATABASE %s WITH TEMPLATE template0 ENCODING 'UTF8'";
 +    }
 +    PairVec options;
 +    options.push_back(std::make_pair("dbname", dbname));
 +    try
 +    {
 +        set_options(conn, options);
 +    }
 +    catch (std::runtime_error& err)
 +    {
 +        set_error (ERR_BACKEND_SERVER_ERR);
 +        return false;
 +    }
 +
 +    auto result = dbi_conn_connect (conn);
 +    if (result < 0)
 +    {
 +        PERR ("Unable to connect to %s database", dbname);
 +        set_error(ERR_BACKEND_SERVER_ERR);
 +        return false;
 +    }
 +    if (Type == DbType::DBI_MYSQL)
 +        adjust_sql_options(conn);
 +    auto dresult = dbi_conn_queryf (conn, dbcreate, db);
 +    if (dresult == nullptr)
 +    {
 +        PERR ("Unable to create database '%s'\n", db);
 +        set_error (ERR_BACKEND_SERVER_ERR);
 +        return false;
 +    }
 +    if (Type == DbType::DBI_PGSQL)
 +    {
 +        const char *alterdb = "ALTER DATABASE %s SET "
 +            "standard_conforming_strings TO on";
 +        dbi_conn_queryf (conn, alterdb, db);
 +    }
 +    dbi_conn_close(conn);
 +    conn = nullptr;
 +    return true;
 +}
 +
 +template <> void
 +error_handler<DbType::DBI_SQLITE> (dbi_conn conn, void* user_data)
 +{
 +    const char* msg;
 +    GncDbiBackend<DbType::DBI_SQLITE> *dbi_be =
 +        static_cast<decltype(dbi_be)>(user_data);
-     int errnum = dbi_conn_error (conn, &msg);
++    int err_num = dbi_conn_error (conn, &msg);
++    /* BADIDX is raised if we attempt to seek outside of a result. We
++     * handle that possibility after checking the return value of the
++     * seek. Having this raise a critical error breaks looping by
++     * testing for the return value of the seek.
++     */
++    if (err_num == DBI_ERROR_BADIDX) return;
 +    PERR ("DBI error: %s\n", msg);
 +    if (dbi_be->connected())
 +        dbi_be->set_dbi_error (ERR_BACKEND_MISC, 0, false);
 +}
 +
 +template <> void
 +GncDbiBackend<DbType::DBI_SQLITE>::session_begin(QofSession* session,
 +                                                 const char* book_id,
 +                                                 bool ignore_lock,
 +                                                 bool create, bool force)
 +{
 +    gboolean file_exists;
 +    PairVec options;
 +
 +    g_return_if_fail (session != nullptr);
 +    g_return_if_fail (book_id != nullptr);
 +
 +    ENTER (" ");
 +
 +    /* Remove uri type if present */
 +    auto path = gnc_uri_get_path (book_id);
 +    std::string filepath{path};
 +    g_free(path);
 +    GFileTest ftest = static_cast<decltype (ftest)> (
 +        G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS) ;
 +    file_exists = g_file_test (filepath.c_str(), ftest);
 +    if (!create && !file_exists)
 +    {
 +        set_error (ERR_FILEIO_FILE_NOT_FOUND);
 +        std::string msg{"Sqlite3 file "};
 +        set_message (msg + filepath + " not found");
 +        PWARN ("Sqlite3 file %s not found", filepath.c_str());
 +        LEAVE("Error");
 +	return;
 +    }
 +
 +    if (create && !force && file_exists)
 +    {
 +        set_error (ERR_BACKEND_STORE_EXISTS);
 +        auto msg = "Might clobber, no force";
 +        PWARN ("%s", msg);
 +        LEAVE("Error");
 +	return;
 +    }
 +
 +    connect(nullptr);
 +    /* dbi-sqlite3 documentation says that sqlite3 doesn't take a "host" option */
 +    options.push_back(std::make_pair("host", "localhost"));
 +    auto dirname = g_path_get_dirname (filepath.c_str());
 +    auto basename = g_path_get_basename (filepath.c_str());
 +    options.push_back(std::make_pair("dbname", basename));
 +    options.push_back(std::make_pair("sqlite3_dbdir", dirname));
 +    if (basename != nullptr) g_free (basename);
 +    if (dirname != nullptr) g_free (dirname);
 +    UriStrings uri;
 +    auto conn = conn_setup(options, uri);
 +    if (conn == nullptr)
 +    {
 +        LEAVE("Error");
 +        return;
 +    }
 +
 +    auto result = dbi_conn_connect (conn);
 +
 +    if (result < 0)
 +    {
 +        dbi_conn_close(conn);
 +        PERR ("Unable to connect to %s: %d\n", book_id, result);
 +        set_error (ERR_BACKEND_BAD_URL);
 +        LEAVE("Error");
 +	return;
 +    }
 +
 +    if (!conn_test_dbi_library(conn))
 +    {
 +        if (create && !file_exists)
 +        {
 +         /* File didn't exist before, but it does now, and we don't want to
 +          * leave it lying around.
 +          */
 +            dbi_conn_close (conn);
 +            conn = nullptr;
 +            g_unlink (filepath.c_str());
 +        }
 +        dbi_conn_close(conn);
 +        LEAVE("Bad DBI Library");
 +        return;
 +    }
 +
 +    try
 +    {
 +        connect(new GncDbiSqlConnection(DbType::DBI_SQLITE,
 +                                            this, conn, ignore_lock));
 +    }
 +    catch (std::runtime_error& err)
 +    {
 +        return;
 +    }
 +
 +    /* We should now have a proper session set up.
 +     * Let's start logging */
 +    xaccLogSetBaseName (filepath.c_str());
 +    PINFO ("logpath=%s", filepath.c_str() ? filepath.c_str() : "(null)");
 +
 +    LEAVE ("");
 +}
 +
 +
 +template <> void
 +error_handler<DbType::DBI_MYSQL> (dbi_conn conn, void* user_data)
 +{
 +    GncDbiBackend<DbType::DBI_MYSQL>* dbi_be =
 +        static_cast<decltype(dbi_be)>(user_data);
 +    const char* msg;
 +
 +    auto err_num = dbi_conn_error (conn, &msg);
++    /* BADIDX is raised if we attempt to seek outside of a result. We
++     * handle that possibility after checking the return value of the
++     * seek. Having this raise a critical error breaks looping by
++     * testing for the return value of the seek.
++     */
++    if (err_num == DBI_ERROR_BADIDX) return;
 +
 +    /* Note: the sql connection may not have been initialized yet
 +     *       so let's be careful with using it
 +     */
 +
 +    /* Database doesn't exist. When this error is triggered the
 +     * GncDbiSqlConnection may not exist yet either, so don't use it here
 +     */
 +    if (err_num == 1049)            // Database doesn't exist
 +    {
 +        PINFO ("DBI error: %s\n", msg);
 +        dbi_be->set_exists(false);
 +        return;
 +    }
 +
 +    /* All the other error handling code assumes the GncDbiSqlConnection
 +     *  has been initialized. So let's assert it exits here, otherwise
 +     * simply return.
 +     */
 +    if (!dbi_be->connected())
 +    {
 +        PINFO ("DBI error: %s\n", msg);
 +        PINFO ("Note: GbcDbiSqlConnection not yet initialized. Skipping further error processing.");
 +        return;
 +    }
 +
 +    /* Test for other errors */
 +    if (err_num == 2006)       // Server has gone away
 +    {
 +        PINFO ("DBI error: %s - Reconnecting...\n", msg);
 +        dbi_be->set_dbi_error (ERR_BACKEND_CONN_LOST, 1, true);
 +        dbi_be->retry_connection(msg);
 +    }
 +    else if (err_num == 2003)       // Unable to connect
 +    {
 +        dbi_be->set_dbi_error (ERR_BACKEND_CANT_CONNECT, 1, true);
 +        dbi_be->retry_connection (msg);
 +    }
 +    else                            // Any other error
 +    {
 +        PERR ("DBI error: %s\n", msg);
 +        dbi_be->set_dbi_error (ERR_BACKEND_MISC, 0, FALSE);
 +    }
 +}
 +
 +#define SQL_OPTION_TO_REMOVE "NO_ZERO_DATE"
 +
 +/* Given an sql_options string returns a copy of the string adjusted as
 + * necessary.  In particular if string the contains SQL_OPTION_TO_REMOVE it is
 + * removed along with comma separator.
 + */
 +std::string
 +adjust_sql_options_string(const std::string& str)
 +{
 +/* Regex that finds the SQL_OPTION_TO_REMOVE as the first, last, or middle of a
 + * comma-delimited list.
 + */
 +    boost::regex reg{"(?:," SQL_OPTION_TO_REMOVE "$|\\b"
 +            SQL_OPTION_TO_REMOVE "\\b,?)"};
 +    return regex_replace(str, reg, std::string{""});
 +}
 +
 +/* checks mysql sql_options and adjusts if necessary */
 +static void
 +adjust_sql_options (dbi_conn connection)
 +{
 +    dbi_result result = dbi_conn_query( connection, "SELECT @@sql_mode");
 +    if (result == nullptr)
 +    {
 +        const char* errmsg;
 +        int err = dbi_conn_error(connection, &errmsg);
 +        PERR("Unable to read sql_mode %d : %s", err, errmsg);
 +        return;
 +    }
 +    dbi_result_first_row(result);
 +    std::string str{dbi_result_get_string_idx(result, 1)};
 +    dbi_result_free(result);
 +    if (str.empty())
 +    {
 +        const char* errmsg;
 +        int err = dbi_conn_error(connection, &errmsg);
 +	if (err)
 +	    PERR("Unable to get sql_mode %d : %s", err, errmsg);
 +	else
 +	    PINFO("Sql_mode isn't set.");
 +        return;
 +    }
 +    PINFO("Initial sql_mode: %s", str.c_str());
 +    if(str.find(SQL_OPTION_TO_REMOVE) == std::string::npos)
 +        return;
 +
 +    std::string adjusted_str{adjust_sql_options_string(str)};
 +    PINFO("Setting sql_mode to %s", adjusted_str.c_str());
 +    std::string set_str{"SET sql_mode=" + std::move(adjusted_str)};
 +    dbi_result set_result = dbi_conn_query(connection,
 +                                           set_str.c_str());
 +    if (set_result)
 +    {
 +        dbi_result_free(set_result);
 +    }
 +    else
 +    {
 +        const char* errmsg;
 +        int err = dbi_conn_error(connection, &errmsg);
 +        PERR("Unable to set sql_mode %d : %s", err, errmsg);
 +    }
 +}
 +
 +
 +template <DbType Type> void
 +GncDbiBackend<Type>::session_begin (QofSession* session, const char* book_id,
 +                                    bool ignore_lock, bool create, bool force)
 +{
 +    GncDbiTestResult dbi_test_result = GNC_DBI_PASS;
 +    PairVec options;
 +
 +    g_return_if_fail (session != nullptr);
 +    g_return_if_fail (book_id != nullptr);
 +
 +    ENTER (" ");
 +
 +    /* Split the book-id
 +     * Format is protocol://username:password@hostname:port/dbname
 +     where username, password and port are optional) */
 +    UriStrings uri(book_id);
 +
 +    if (Type == DbType::DBI_PGSQL)
 +    {
 +        if (uri.m_portnum == 0)
 +            uri.m_portnum = PGSQL_DEFAULT_PORT;
 +        /* Postgres's SQL interface coerces identifiers to lower case, but the
 +         * C interface is case-sensitive. This results in a mixed-case dbname
 +         * being created (with a lower case name) but then dbi can't conect to
 +         * it. To work around this, coerce the name to lowercase first. */
 +        auto lcname = g_utf8_strdown (uri.dbname(), -1);
 +        uri.m_dbname = std::string{lcname};
 +        g_free(lcname);
 +    }
 +    connect(nullptr);
 +
 +    auto conn = conn_setup(options, uri);
 +    if (conn == nullptr)
 +    {
 +        LEAVE("Error");
 +        return;
 +    }
 +
 +    m_exists = true; //May be unset in the error handler.
 +    auto result = dbi_conn_connect (conn);
 +    if (result == 0)
 +    {
 +        if (Type == DbType::DBI_MYSQL)
 +            adjust_sql_options (conn);
 +        if(!conn_test_dbi_library(conn))
 +        {
 +            dbi_conn_close(conn);
 +            LEAVE("Error");
 +            return;
 +        }
 +        if (create && !force && save_may_clobber_data (conn,
 +                                                       uri.quote_dbname(Type)))
 +        {
 +            set_error (ERR_BACKEND_STORE_EXISTS);
 +            PWARN ("Databse already exists, Might clobber it.");
 +            dbi_conn_close(conn);
 +            LEAVE("Error");
 +            return;
 +        }
 +
 +    }
 +    else
 +    {
 +
 +        if (m_exists)
 +        {
 +            PERR ("Unable to connect to database '%s'\n", uri.dbname());
 +            set_error (ERR_BACKEND_SERVER_ERR);
 +            dbi_conn_close(conn);
 +            LEAVE("Error");
 +            return;
 +        }
 +
 +        if (create)
 +        {
 +            if (!create_database(conn, uri.quote_dbname(Type).c_str()))
 +            {
 +                dbi_conn_close(conn);
 +                LEAVE("Error");
 +                return;
 +            }
 +            conn = conn_setup(options, uri);
 +            result = dbi_conn_connect (conn);
 +            if (result < 0)
 +            {
 +                PERR ("Unable to create database '%s'\n", uri.dbname());
 +                set_error (ERR_BACKEND_SERVER_ERR);
 +                dbi_conn_close(conn);
 +                LEAVE("Error");
 +                return;
 +            }
 +            if (Type == DbType::DBI_MYSQL)
 +                adjust_sql_options (conn);
 +            if (!conn_test_dbi_library(conn))
 +            {
 +                if (Type == DbType::DBI_PGSQL)
 +                    dbi_conn_select_db (conn, "template1");
 +                dbi_conn_queryf (conn, "DROP DATABASE %s",
 +                                 uri.quote_dbname(Type).c_str());
 +                dbi_conn_close(conn);
 +                return;
 +            }
 +        }
 +        else
 +        {
 +            set_error(ERR_BACKEND_NO_SUCH_DB);
 +            std::string msg{"Database "};
 +            set_message(msg + uri.dbname() + " not found");
 +        }
 +    }
 +
 +    connect(nullptr);
 +    try
 +    {
 +        connect(new GncDbiSqlConnection(Type, this, conn, ignore_lock));
 +    }
 +    catch (std::runtime_error& err)
 +    {
 +        return;
 +    }
 +    /* We should now have a proper session set up.
 +     * Let's start logging */
 +    auto translog_path = gnc_build_translog_path (uri.basename().c_str());
 +    xaccLogSetBaseName (translog_path);
 +    PINFO ("logpath=%s", translog_path ? translog_path : "(null)");
 +    g_free (translog_path);
 +
 +    LEAVE (" ");
 +}
 +
 +template<> void
 +error_handler<DbType::DBI_PGSQL> (dbi_conn conn, void* user_data)
 +{
 +    GncDbiBackend<DbType::DBI_PGSQL>* dbi_be =
 +        static_cast<decltype(dbi_be)>(user_data);
 +    const char* msg;
 +
-     (void)dbi_conn_error (conn, &msg);
++    auto err_num = dbi_conn_error (conn, &msg);
++    /* BADIDX is raised if we attempt to seek outside of a result. We
++     * handle that possibility after checking the return value of the
++     * seek. Having this raise a critical error breaks looping by
++     * testing for the return value of the seek.
++     */
++    if (err_num == DBI_ERROR_BADIDX) return;
 +    if (g_str_has_prefix (msg, "FATAL:  database") &&
 +        g_str_has_suffix (msg, "does not exist\n"))
 +    {
 +        PINFO ("DBI error: %s\n", msg);
 +        dbi_be->set_exists(false);
 +    }
 +    else if (g_strrstr (msg,
 +                        "server closed the connection unexpectedly"))    // Connection lost
 +    {
 +        if (!dbi_be->connected())
 +        {
 +            PWARN ("DBI Error: Connection lost, connection pointer invalid");
 +            return;
 +        }
 +        PINFO ("DBI error: %s - Reconnecting...\n", msg);
 +        dbi_be->set_dbi_error (ERR_BACKEND_CONN_LOST, 1, true);
 +        dbi_be->retry_connection(msg);
 +    }
 +    else if (g_str_has_prefix (msg, "connection pointer is NULL") ||
 +             g_str_has_prefix (msg, "could not connect to server"))       // No connection
 +    {
 +
 +        if (!dbi_be->connected())
 +            qof_backend_set_error(reinterpret_cast<QofBackend*>(dbi_be),
 +                                  ERR_BACKEND_CANT_CONNECT);
 +        else
 +        {
 +            dbi_be->set_dbi_error(ERR_BACKEND_CANT_CONNECT, 1, true);
 +            dbi_be->retry_connection (msg);
 +        }
 +    }
 +    else
 +    {
 +        PERR ("DBI error: %s\n", msg);
 +        if (dbi_be->connected())
 +            dbi_be->set_dbi_error (ERR_BACKEND_MISC, 0, false);
 +    }
 +}
 +
 +/* ================================================================= */
 +
 +template <DbType Type> void
 +GncDbiBackend<Type>::session_end ()
 +{
 +    ENTER (" ");
 +
 +    finalize_version_info ();
 +    connect(nullptr);
 +
 +    LEAVE (" ");
 +}
 +
 +template <DbType Type>
 +GncDbiBackend<Type>::~GncDbiBackend()
 +{
 +    /* Stop transaction logging */
 +    xaccLogSetBaseName (nullptr);
 +}
 +
 +/* ================================================================= */
 +
 +/* GNUCASH_RESAVE_VERSION indicates the earliest database version
 + * compatible with this version of Gnucash; the stored value is the
 + * earliest version of Gnucash conpatible with the database. If the
 + * GNUCASH_RESAVE_VERSION for this Gnucash is newer than the Gnucash
 + * version which created the database, a resave is offered. If the
 + * version of this Gnucash is older than the saved resave version,
 + * then the database will be loaded read-only. A resave will update
 + * both values to match this version of Gnucash.
 + */
 +template <DbType Type> void
 +GncDbiBackend<Type>::load (QofBook* book, QofBackendLoadType loadType)
 +{
 +    g_return_if_fail (book != nullptr);
 +
 +    ENTER ("dbi_be=%p, book=%p", this, book);
 +
 +    if (loadType == LOAD_TYPE_INITIAL_LOAD)
 +    {
 +
 +        // Set up table version information
 +        init_version_info ();
 +        assert (m_book == nullptr);
 +        create_tables();
 +    }
 +
 +    GncSqlBackend::load(book, loadType);
 +
 +    if (GNUCASH_RESAVE_VERSION > get_table_version("Gnucash"))
 +    {
 +        /* The database was loaded with an older database schema or
 +         * data semantics. In order to ensure consistency, the whole
 +         * thing needs to be saved anew. */
 +        set_error(ERR_SQL_DB_TOO_OLD);
 +    }
 +    else if (GNUCASH_RESAVE_VERSION < get_table_version("Gnucash-Resave"))
 +    {
 +        /* Worse, the database was created with a newer version. We
 +         * can't safely write to this database, so the user will have
 +         * to do a "save as" to make one that we can write to.
 +         */
 +        set_error(ERR_SQL_DB_TOO_NEW);
 +    }
 +
 +
 +    LEAVE ("");
 +}
 +
 +/* ================================================================= */
 +/* This is used too early to call GncDbiProvider::get_table_list(). */
 +static bool
 +save_may_clobber_data (dbi_conn conn, const std::string& dbname)
 +{
 +
 +    /* Data may be clobbered iff the number of tables != 0 */
 +    auto result = dbi_conn_get_table_list (conn, dbname.c_str(), nullptr);
 +    bool retval = false;
 +    if (result)
 +    {
 +        retval =  dbi_result_get_numrows (result) > 0;
 +        dbi_result_free (result);
 +    }
 +    return retval;
 +}
 +
 +
 +/**
 + * Safely resave a database by renaming all of its tables, recreating
 + * everything, and then dropping the backup tables only if there were
 + * no errors. If there are errors, drop the new tables and restore the
 + * originals.
 + *
 + * @param book: QofBook to be saved in the database.
 + */
 +template <DbType Type> void
 +GncDbiBackend<Type>::safe_sync (QofBook* book)
 +{
 +    auto conn = dynamic_cast<GncDbiSqlConnection*>(m_conn);
 +
 +    g_return_if_fail (conn != nullptr);
 +    g_return_if_fail (book != nullptr);
 +
 +    ENTER ("book=%p, primary=%p", book, m_book);
 +    if (!conn->begin_transaction())
 +    {
 +        LEAVE("Failed to obtain a transaction.");
 +        return;
 +    }
 +    if (!conn->table_operation (TableOpType::backup))
 +    {
 +        conn->rollback_transaction();
 +        LEAVE ("Failed to rename tables");
 +        return;
 +    }
 +    if (!conn->drop_indexes())
 +    {
 +        conn->rollback_transaction();
 +        LEAVE ("Failed to drop indexes");
 +        return;
 +    }
 +
 +    sync(m_book);
 +    if (check_error())
 +    {
 +        conn->rollback_transaction();
 +        LEAVE ("Failed to create new database tables");
 +        return;
 +    }
 +    conn->table_operation (TableOpType::drop_backup);
 +    conn->commit_transaction();
 +    LEAVE ("book=%p", m_book);
 +}
 +/* MySQL commits the transaction and all savepoints after the first CREATE
 + * TABLE, crashing when we try to RELEASE SAVEPOINT because the savepoint
 + * doesn't exist after the commit. We must run without a wrapping transaction in
 + * that case.
 + */
 +template <> void
 +GncDbiBackend<DbType::DBI_MYSQL>::safe_sync (QofBook* book)
 +{
 +    auto conn = dynamic_cast<GncDbiSqlConnection*>(m_conn);
 +
 +    g_return_if_fail (conn != nullptr);
 +    g_return_if_fail (book != nullptr);
 +
 +    ENTER ("book=%p, primary=%p", book, m_book);
 +    if (!conn->table_operation (TableOpType::backup))
 +    {
 +        set_error(ERR_BACKEND_SERVER_ERR);
 +        conn->table_operation (TableOpType::rollback);
 +        LEAVE ("Failed to rename tables");
 +        return;
 +    }
 +    if (!conn->drop_indexes())
 +    {
 +        conn->table_operation (TableOpType::rollback);
 +        set_error (ERR_BACKEND_SERVER_ERR);
 +        set_message("Failed to drop indexes");
 +        LEAVE ("Failed to drop indexes");
 +        return;
 +    }
 +
 +    sync(m_book);
 +    if (check_error())
 +    {
 +        conn->table_operation (TableOpType::rollback);
 +        LEAVE ("Failed to create new database tables");
 +        return;
 +    }
 +    conn->table_operation (TableOpType::drop_backup);
 +    LEAVE ("book=%p", m_book);
 +}
 +/* ================================================================= */
 +
 +/*
 + * Checks to see whether the file is an sqlite file or not
 + *
 + */
 +template<> bool
 +QofDbiBackendProvider<DbType::DBI_SQLITE>::type_check(const char *uri)
 +{
 +    FILE* f;
 +    gchar buf[50];
 +    G_GNUC_UNUSED size_t chars_read;
 +    gint status;
 +    gchar* filename;
 +
 +    // BAD if the path is null
 +    g_return_val_if_fail (uri != nullptr, FALSE);
 +
 +    filename = gnc_uri_get_path (uri);
 +    f = g_fopen (filename, "r");
 +    g_free (filename);
 +
 +    // OK if the file doesn't exist - new file
 +    if (f == nullptr)
 +    {
 +        PINFO ("doesn't exist (errno=%d) -> DBI", errno);
 +        return TRUE;
 +    }
 +
 +    // OK if file has the correct header
 +    chars_read = fread (buf, sizeof (buf), 1, f);
 +    status = fclose (f);
 +    if (status < 0)
 +    {
 +        PERR ("Error in fclose(): %d\n", errno);
 +    }
 +    if (g_str_has_prefix (buf, "SQLite format 3"))
 +    {
 +        PINFO ("has SQLite format string -> DBI");
 +        return TRUE;
 +    }
 +    PINFO ("exists, does not have SQLite format string -> not DBI");
 +
 +    // Otherwise, BAD
 +    return FALSE;
 +}
 +
 +void
 +gnc_module_init_backend_dbi (void)
 +{
 +    const char* driver_dir;
 +    int num_drivers;
 +    gboolean have_sqlite3_driver = FALSE;
 +    gboolean have_mysql_driver = FALSE;
 +    gboolean have_pgsql_driver = FALSE;
 +
 +    /* Initialize libdbi and see which drivers are available.  Only register qof backends which
 +       have drivers available. */
 +    driver_dir = g_getenv ("GNC_DBD_DIR");
 +    if (driver_dir == nullptr)
 +    {
 +        PINFO ("GNC_DBD_DIR not set: using libdbi built-in default\n");
 +    }
 +
 +    /* dbi_initialize returns -1 in case of errors */
 +#if HAVE_LIBDBI_R
 +    if (dbi_instance)
 +        return;
 +    num_drivers = dbi_initialize_r (driver_dir, &dbi_instance);
 +#else
 +    num_drivers = dbi_initialize (driver_dir);
 +#endif
 +    if (num_drivers <= 0)
 +    {
 +        gchar* dir = g_build_filename (gnc_path_get_libdir (), "dbd", nullptr);
 +#if HAVE_LIBDBI_R
 +        if (dbi_instance)
 +            return;
 +        num_drivers = dbi_initialize_r (dir, &dbi_instance);
 +#else
 +        num_drivers = dbi_initialize (dir);
 +#endif
 +        g_free (dir);
 +    }
 +    if (num_drivers <= 0)
 +    {
 +        PWARN ("No DBD drivers found\n");
 +    }
 +    else
 +    {
 +        dbi_driver driver = nullptr;
 +        PINFO ("%d DBD drivers found\n", num_drivers);
 +
 +        do
 +        {
 +#if HAVE_LIBDBI_R
 +            driver = dbi_driver_list_r (driver, dbi_instance);
 +#else
 +            driver = dbi_driver_list (driver);
 +#endif
 +
 +            if (driver != nullptr)
 +            {
 +                const gchar* name = dbi_driver_get_name (driver);
 +
 +                PINFO ("Driver: %s\n", name);
 +                if (strcmp (name, "sqlite3") == 0)
 +                {
 +                    have_sqlite3_driver = TRUE;
 +                }
 +                else if (strcmp (name, "mysql") == 0)
 +                {
 +                    have_mysql_driver = TRUE;
 +                }
 +                else if (strcmp (name, "pgsql") == 0)
 +                {
 +                    have_pgsql_driver = TRUE;
 +                }
 +            }
 +        }
 +        while (driver != nullptr);
 +    }
 +
 +    if (have_sqlite3_driver)
 +    {
 +        const char* name = "GnuCash Libdbi (SQLITE3) Backend";
 +        auto prov = QofBackendProvider_ptr(new QofDbiBackendProvider<DbType::DBI_SQLITE>{name, FILE_URI_TYPE});
 +        qof_backend_register_provider(std::move(prov));
 +        prov = QofBackendProvider_ptr(new QofDbiBackendProvider<DbType::DBI_SQLITE>{name, SQLITE3_URI_TYPE});
 +        qof_backend_register_provider(std::move(prov));
 +    }
 +
 +    if (have_mysql_driver)
 +    {
 +        const char *name = "GnuCash Libdbi (MYSQL) Backend";
 +        auto prov = QofBackendProvider_ptr(new QofDbiBackendProvider<DbType::DBI_MYSQL>{name, "mysql"});
 +        qof_backend_register_provider(std::move(prov));
 +    }
 +
 +    if (have_pgsql_driver)
 +    {
 +        const char* name = "GnuCash Libdbi (POSTGRESQL) Backend";
 +        auto prov = QofBackendProvider_ptr(new QofDbiBackendProvider<DbType::DBI_PGSQL>{name, "postgres"});
 +        qof_backend_register_provider(std::move(prov));
 +    }
 +
 +    /* If needed, set log level to DEBUG so that SQl statements will be put into
 +       the gnucash.trace file. */
 +    /*    qof_log_set_level( log_module, QOF_LOG_DEBUG ); */
 +}
 +
 +#ifndef GNC_NO_LOADABLE_MODULES
 +G_MODULE_EXPORT void
 +qof_backend_module_init (void)
 +{
 +    gnc_module_init_backend_dbi ();
 +}
 +
 +G_MODULE_EXPORT void
 +qof_backend_module_finalize (void)
 +{
 +    gnc_module_finalize_backend_dbi ();
 +}
 +#endif /* GNC_NO_LOADABLE_MODULES */
 +
 +void
 +gnc_module_finalize_backend_dbi (void)
 +{
 +#if HAVE_LIBDBI_R
 +    if (dbi_instance)
 +    {
 +        dbi_shutdown_r (dbi_instance);
 +        dbi_instance = nullptr;
 +    }
 +#else
 +    dbi_shutdown ();
 +#endif
 +}
 +
 +/* --------------------------------------------------------- */
 +
 +/** Users discovered a bug in some distributions of libdbi, where if
 + * it is compiled on certain versions of gcc with the -ffast-math
 + * compiler option it fails to correctly handle saving of 64-bit
 + * values. This function tests for the problem.
 + * @param: conn: The just-opened dbi_conn
 + * @returns: GNC_DBI_PASS if the dbi library is safe to use,
 + * GNC_DBI_FAIL_SETUP if the test could not be completed, or
 + * GNC_DBI_FAIL_TEST if the bug was found.
 + */
 +static GncDbiTestResult
 +dbi_library_test (dbi_conn conn)
 +{
 +    int64_t testlonglong = -9223372036854775807LL, resultlonglong = 0;
 +    uint64_t testulonglong = 9223372036854775807LLU, resultulonglong = 0;
 +    double testdouble = 1.7976921348623157E+307, resultdouble = 0.0;
 +    dbi_result result;
 +    GncDbiTestResult retval = GNC_DBI_PASS;
 +
 +    result = dbi_conn_query (conn, "CREATE TEMPORARY TABLE numtest "
 +                             "( test_int BIGINT, test_unsigned BIGINT,"
 +                             " test_double FLOAT8 )");
 +    if (result == nullptr)
 +    {
 +        PWARN ("Test_DBI_Library: Create table failed");
 +        return GNC_DBI_FAIL_SETUP;
 +    }
 +    dbi_result_free (result);
 +    std::stringstream querystr;
 +    querystr << "INSERT INTO numtest VALUES (" << testlonglong <<
 +        ", " << testulonglong << ", " << std::setprecision(12) <<
 +        testdouble << ")";
 +    auto query = querystr.str();
 +    result = dbi_conn_query (conn, query.c_str());
 +    if (result == nullptr)
 +    {
 +        PWARN ("Test_DBI_Library: Failed to insert test row into table");
 +        return GNC_DBI_FAIL_SETUP;
 +    }
 +    dbi_result_free (result);
 +    gnc_push_locale (LC_NUMERIC, "C");
 +    result = dbi_conn_query (conn, "SELECT * FROM numtest");
 +    if (result == nullptr)
 +    {
 +        const char* errmsg;
 +        dbi_conn_error (conn, &errmsg);
 +        PWARN ("Test_DBI_Library: Failed to retrieve test row into table: %s",
 +               errmsg);
 +        dbi_conn_query (conn, "DROP TABLE numtest");
 +        gnc_pop_locale (LC_NUMERIC);
 +        return GNC_DBI_FAIL_SETUP;
 +    }
 +    while (dbi_result_next_row (result))
 +    {
 +        resultlonglong = dbi_result_get_longlong (result, "test_int");
 +        resultulonglong = dbi_result_get_ulonglong (result, "test_unsigned");
 +        resultdouble = dbi_result_get_double (result, "test_double");
 +    }
 +    dbi_conn_query (conn, "DROP TABLE numtest");
 +    gnc_pop_locale (LC_NUMERIC);
 +    if (testlonglong != resultlonglong)
 +    {
 +        PWARN ("Test_DBI_Library: LongLong Failed %" PRId64 " != % " PRId64,
 +               testlonglong, resultlonglong);
 +        retval = GNC_DBI_FAIL_TEST;
 +    }
 +    if (testulonglong != resultulonglong)
 +    {
 +        PWARN ("Test_DBI_Library: Unsigned longlong Failed %" PRIu64 " != %"
 +               PRIu64, testulonglong, resultulonglong);
 +        retval = GNC_DBI_FAIL_TEST;
 +    }
 +    /* A bug in libdbi stores only 7 digits of precision */
 +    if (testdouble >= resultdouble + 0.000001e307 ||
 +        testdouble <= resultdouble - 0.000001e307)
 +    {
 +        PWARN ("Test_DBI_Library: Double Failed %17e != %17e",
 +               testdouble, resultdouble);
 +        retval = GNC_DBI_FAIL_TEST;
 +    }
 +    return retval;
 +}
 +
 +template <DbType Type> bool
 +GncDbiBackend<Type>::conn_test_dbi_library(dbi_conn conn)
 +{
 +    auto result = dbi_library_test (conn);
 +    switch (result)
 +    {
 +        case GNC_DBI_PASS:
 +            break;
 +
 +        case GNC_DBI_FAIL_SETUP:
 +            set_error(ERR_SQL_DBI_UNTESTABLE);
 +            set_message ("DBI library large number test incomplete");
 +            break;
 +
 +        case GNC_DBI_FAIL_TEST:
 +            set_error (ERR_SQL_BAD_DBI);
 +            set_message ("DBI library fails large number test");
 +            break;
 +    }
 +    return result == GNC_DBI_PASS;
 +}
 +
 +/* ========================== END OF FILE ===================== */
diff --cc libgnucash/engine/ScrubBusiness.c
index 436ce56,0000000..2414d0e
mode 100644,000000..100644
--- a/libgnucash/engine/ScrubBusiness.c
+++ b/libgnucash/engine/ScrubBusiness.c
@@@ -1,716 -1,0 +1,716 @@@
 +/********************************************************************\
 + * ScrubBusiness.h -- Cleanup functions for the business objects.   *
 + *                                                                  *
 + * 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                   *
 +\********************************************************************/
 +
 +/** @file ScrubBusiness.h
 + *  @brief Cleanup functions for business objects
 + *  @author Created by Geert Janssens August 2014
 + *  @author Copyright (c) 2014 Geert Janssens <geert at kobaltwit.be>
 + *
 + * Provides the high-level API for checking and repairing ('scrubbing
 + * clean') the various data objects used by the business functions.*/
 +
 +#include <config.h>
 +
 +#include <glib.h>
 +#include <glib/gi18n.h>
 +
 +#include "gnc-engine.h"
 +#include "gnc-lot.h"
 +#include "policy-p.h"
 +#include "Account.h"
 +#include "gncInvoice.h"
 +#include "gncInvoiceP.h"
 +#include "Scrub2.h"
 +#include "ScrubBusiness.h"
 +#include "Transaction.h"
 +
 +#undef G_LOG_DOMAIN
 +#define G_LOG_DOMAIN "gnc.engine.scrub"
 +
 +static QofLogModule log_module = G_LOG_DOMAIN;
 +
 +static void
 +gncScrubInvoiceState (GNCLot *lot)
 +{
 +    SplitList *ls_iter = NULL;
 +    GncInvoice *invoice = NULL;
 +    GncInvoice *lot_invoice = gncInvoiceGetInvoiceFromLot (lot);
 +
 +    for (ls_iter = gnc_lot_get_split_list (lot); ls_iter; ls_iter = ls_iter->next)
 +    {
 +        Split *split = ls_iter->data;
 +        Transaction *txn = NULL; // ll_txn = "Lot Link Transaction"
 +
 +        if (!split)
 +            continue; // next scrub lot split
 +
 +        txn = xaccSplitGetParent (split);
 +        invoice = gncInvoiceGetInvoiceFromTxn (txn);
 +        if (invoice)
 +            break;
 +
 +    }
 +
 +    if (invoice != lot_invoice)
 +    {
 +        PINFO("Correcting lot invoice associaton. Old invoice: %p, new invoice %p", lot_invoice, invoice);
 +        gncInvoiceDetachFromLot(lot);
 +
 +        if (invoice)
 +            gncInvoiceAttachToLot (invoice, lot);
 +        else
 +            gncOwnerAttachToLot (gncInvoiceGetOwner(lot_invoice), lot);
 +    }
 +}
 +
 +// A helper function that takes two splits. If the splits are  of opposite sign
 +// it reduces the biggest split to have the same value (but with opposite sign)
 +// of the smaller split.
 +// To make sure everything still continues to balance in addition a "remainder" split
 +// will be created that will be added to the same lot and transaction as the biggest
 +// split.
 +// The opposite sign restriction is because that's the only scenario that makes sense
 +// in the context of scrubbing business lots below.
 +// If we created new splits, return TRUE, otherwise FALSE
 +static gboolean reduce_biggest_split (Split *splitA, Split *splitB)
 +{
 +    gnc_numeric valA = xaccSplitGetValue (splitA);
 +    gnc_numeric valB = xaccSplitGetValue (splitB);
 +
 +    if (gnc_numeric_compare (gnc_numeric_abs (valA), gnc_numeric_abs (valB)) >= 0)
 +        return gncOwnerReduceSplitTo (splitA, gnc_numeric_neg (valB));
 +    else
 +        return gncOwnerReduceSplitTo (splitB, gnc_numeric_neg (valA));
 +}
 +
 +// Attempt to eliminate or reduce the lot link splits (ll_*_split)
 +// between from_lot and to_lot. To do so this function will attempt
 +// to move a payment split from from_lot to to_lot in order to
 +// balance the lot link split that will be deleted.
 +// To ensure everything remains balanced at most
 +// min (val-ll-*-split, val-pay-split) (in absolute values) can be moved.
 +// If any split involved has a larger value, it will be split in two
 +// and only the part matching the other splits' value will be used.
 +// The leftover splits are kept in the respective transactions/lots.
 +// A future scrub action can still act on those if needed.
 +//
 +// Note that this function assumes that ll_from_split and ll_to_split are
 +// of opposite sign. The calling function should check this.
 +
 +static gboolean
 +scrub_other_link (GNCLot *from_lot, Split *ll_from_split,
 +                  GNCLot *to_lot,   Split *ll_to_split)
 +{
 +    Split *real_from_split; // This refers to the split in the payment lot representing the payment itself
 +    gboolean modified = FALSE;
 +    gnc_numeric real_from_val;
 +    gnc_numeric from_val = xaccSplitGetValue (ll_from_split);
 +    gnc_numeric to_val = xaccSplitGetValue (ll_to_split);
 +    Transaction *ll_txn = xaccSplitGetParent (ll_to_split);
 +
 +    // Per iteration we can only scrub at most min (val-doc-split, val-pay-split)
 +    // So set the ceiling for finding a potential offsetting split in the lot
 +    if (gnc_numeric_compare (gnc_numeric_abs (from_val), gnc_numeric_abs (to_val)) >= 0)
 +        from_val = gnc_numeric_neg (to_val);
 +
 +    // Next we have to find the original payment split so we can
 +    // add (part of) it to the document lot
 +    real_from_split = gncOwnerFindOffsettingSplit (from_lot, from_val);
 +    if (!real_from_split)
 +        return FALSE; // No usable split in the payment lot
 +
 +    // We now have found 3 splits involved in the scrub action:
 +    // 2 lot link splits which we want to reduce
 +    // 1 other split to move into the original lot instead of the lot link split
 +    // As said only value of the split can be offset.
 +    // So split the bigger ones in two if needed and continue with equal valued splits only
 +    // The remainder is added to the lot link transaction and the lot to keep everything balanced
 +    // and will be processed in a future iteration
 +    modified = reduce_biggest_split (ll_from_split, ll_to_split);
 +    modified |= reduce_biggest_split (real_from_split, ll_from_split);
 +    modified |= reduce_biggest_split (ll_from_split, ll_to_split);
 +
 +    // At this point ll_to_split and real_from_split should have the same value
 +    // If not, flag a warning and skip to the next iteration
 +    to_val        = xaccSplitGetValue (ll_to_split);
 +    from_val      = xaccSplitGetValue (ll_from_split);
 +    real_from_val = xaccSplitGetValue (real_from_split);
 +    if (!gnc_numeric_equal (real_from_val, to_val))
 +    {
 +        // This is unexpected - write a warning message and skip this split
 +        PWARN("real_from_val (%s) and to_val (%s) differ. "
 +              "This is unexpected! Skip scrubbing of real_from_split %p against ll_to_split %p.",
 +              gnc_numeric_to_string (real_from_val), // gnc_numeric_denom (real_from_val),
 +              gnc_numeric_to_string (to_val), // gnc_numeric_denom (to_val),
 +              real_from_split, ll_to_split);
 +        return modified;
 +    }
 +
 +    // Now do the actual split dance
 +    // - move real payment split to doc lot
 +    // - delete both lot link splits from the lot link transaction
 +    gnc_lot_add_split (to_lot, real_from_split);
 +    xaccTransBeginEdit (ll_txn);
 +    xaccSplitDestroy (ll_to_split);
 +    xaccSplitDestroy (ll_from_split);
 +    xaccTransCommitEdit (ll_txn);
 +
 +    // Cleanup the lots
 +    xaccScrubMergeLotSubSplits (to_lot, FALSE);
 +    xaccScrubMergeLotSubSplits (from_lot, FALSE);
 +
 +    return TRUE; // We did change splits/transactions/lots...
 +}
 +
 +static gboolean
 +gncScrubLotLinks (GNCLot *scrub_lot)
 +{
 +    gboolean modified = FALSE, restart_needed = FALSE;
 +    SplitList *sls_iter = NULL;
 +
 +scrub_start:
 +    restart_needed = FALSE;
 +
 +    // Iterate over all splits in the lot
 +    for (sls_iter = gnc_lot_get_split_list (scrub_lot); sls_iter; sls_iter = sls_iter->next)
 +    {
 +        Split *sl_split = sls_iter->data;
 +        Transaction *ll_txn = NULL; // ll_txn = "Lot Link Transaction"
 +        SplitList *lts_iter = NULL;
 +
 +        if (!sl_split)
 +            continue; // next scrub lot split
 +
 +        ll_txn = xaccSplitGetParent (sl_split);
 +
 +        if (!ll_txn)
 +        {
 +            // Ooops - the split doesn't belong to any transaction !
 +            // This is not expected so issue a warning and continue with next split
 +            PWARN("Encountered a split in a business lot that's not part of any transaction. "
 +                  "This is unexpected! Skipping split %p.", sl_split);
 +            continue;
 +        }
 +
 +        // Don't scrub invoice type transactions
 +        if (xaccTransGetTxnType (ll_txn) == TXN_TYPE_INVOICE)
 +            continue; // next scrub lot split
 +
 +        // Empty splits can be removed immediately
 +        if (gnc_numeric_zero_p (xaccSplitGetValue (sl_split)) ||
 +                gnc_numeric_zero_p(xaccSplitGetValue (sl_split)))
 +        {
 +            xaccSplitDestroy (sl_split);
 +            modified = TRUE;
 +            goto scrub_start;
 +        }
 +
 +        // Iterate over all splits in the lot link transaction
 +        for (lts_iter = xaccTransGetSplitList (ll_txn); lts_iter; lts_iter = lts_iter->next)
 +        {
 +            Split *ll_txn_split = lts_iter->data; // These all refer to splits in the lot link transaction
 +            GNCLot *remote_lot = NULL; // lot at the other end of the lot link transaction
 +            gboolean sl_is_doc_lot, rl_is_doc_lot;
 +
 +            if (!ll_txn_split)
 +                continue; // next lot link transaction split
 +
 +            // Skip the split in the lot we're currently scrubbing
 +            if (sl_split == ll_txn_split)
 +                continue; // next lot link transaction split
 +
 +            // Skip empty other splits. They'll be scrubbed in the outer for loop later
 +            if (gnc_numeric_zero_p (xaccSplitGetValue (ll_txn_split)) ||
 +                    gnc_numeric_zero_p(xaccSplitGetValue (ll_txn_split)))
 +                continue;
 +
 +            // Only splits of opposite signed values can be scrubbed
 +            if (gnc_numeric_positive_p (xaccSplitGetValue (sl_split)) ==
 +                gnc_numeric_positive_p (xaccSplitGetValue (ll_txn_split)))
 +                continue; // next lot link transaction split
 +
 +            // We can only scrub if the other split is in a lot as well
 +            // Link transactions always have their other split in another lot
 +            // however ordinary payment transactions may not
 +            remote_lot = xaccSplitGetLot (ll_txn_split);
 +            if (!remote_lot)
 +                continue;
 +
 +            sl_is_doc_lot = (gncInvoiceGetInvoiceFromLot (scrub_lot) != NULL);
 +            rl_is_doc_lot = (gncInvoiceGetInvoiceFromLot (remote_lot) != NULL);
 +
 +            // Depending on the type of lots we're comparing, we need different actions
 +            // - Two document lots (an invoice and a credit note):
 +            //   Special treatment - look for all document lots linked via ll_txn
 +            //   and update the memo to be of more use to the users.
 +            // - Two payment lots:
 +            //   (Part of) the link will be eliminated and instead (part of)
 +            //   one payment will be added to the other lot to keep the balance.
 +            //   If the payments are not equal in abs value part of the bigger payment
 +            //   will be moved to the smaller payment's lot.
 +            // - A document and a payment lot:
 +            //   (Part of) the link will be eliminated and instead (part of) the real
 +            //   payment will be added to the document lot to handle the payment.
 +            if (sl_is_doc_lot && rl_is_doc_lot)
 +                gncOwnerSetLotLinkMemo (ll_txn);
 +            else if (!sl_is_doc_lot && !rl_is_doc_lot)
 +            {
 +                gint cmp = gnc_numeric_compare (gnc_numeric_abs (xaccSplitGetValue (sl_split)),
 +                                                gnc_numeric_abs (xaccSplitGetValue (ll_txn_split)));
 +                if (cmp >= 0)
 +                    restart_needed = scrub_other_link (scrub_lot, sl_split, remote_lot, ll_txn_split);
 +                else
 +                    restart_needed = scrub_other_link (remote_lot, ll_txn_split, scrub_lot, sl_split);
 +            }
 +            else
 +            {
 +                GNCLot *doc_lot = sl_is_doc_lot ? scrub_lot : remote_lot;
 +                GNCLot *pay_lot = sl_is_doc_lot ? remote_lot : scrub_lot;
 +                Split *ll_doc_split = sl_is_doc_lot ? sl_split : ll_txn_split;
 +                Split *ll_pay_split = sl_is_doc_lot ? ll_txn_split : sl_split;
 +                // Ok, let's try to move a payment from pay_lot to doc_lot
 +                restart_needed = scrub_other_link (pay_lot, ll_pay_split, doc_lot, ll_doc_split);
 +            }
 +
 +            // If we got here, the splits in our lot and ll_txn have been severely mixed up
 +            // And our iterator lists are probably no longer valid
 +            // So let's start over
 +            if (restart_needed)
 +            {
 +                modified = TRUE;
 +                goto scrub_start;
 +            }
 +
 +        }
 +    }
 +
 +    return modified;
 +}
 +
 +// Note this is a recursive function. It presumes the number of splits
 +// in avail_splits is relatively low. With many splits the performance will
 +// quickly degrade.
 +// Careful: this function assumes all splits in avail_splits to be valid
 +// and with values of opposite sign of target_value
 +// Ignoring this can cause unexpected results!
 +static SplitList *
 +gncSLFindOffsSplits (SplitList *avail_splits, gnc_numeric target_value)
 +{
 +    gint curr_recurse_level = 0;
 +    gint max_recurse_level = g_list_length (avail_splits) - 1;
 +
 +    if (!avail_splits)
 +        return NULL;
 +
 +    for (curr_recurse_level = 0;
 +         curr_recurse_level <= max_recurse_level;
 +         curr_recurse_level++)
 +    {
 +        SplitList *split_iter = NULL;
 +        for (split_iter = avail_splits; split_iter; split_iter = split_iter->next)
 +        {
 +            Split *split = split_iter->data;
 +            SplitList *match_splits = NULL;
 +            gnc_numeric split_value, remaining_value;
 +
 +            split_value = xaccSplitGetValue (split);
 +            // Attention: target_value and split_value are of opposite sign
 +            // So to get the remaining target value, they should be *added*
 +            remaining_value = gnc_numeric_add (target_value, split_value,
 +                                               GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
 +
 +            if (curr_recurse_level == 0)
 +            {
 +                if (gnc_numeric_zero_p (remaining_value))
 +                    match_splits = g_list_prepend (NULL, split);
 +            }
 +            else
 +            {
 +                if (gnc_numeric_positive_p (target_value) ==
 +                    gnc_numeric_positive_p (remaining_value))
 +                    match_splits = gncSLFindOffsSplits (split_iter->next,
 +                                                        remaining_value);
 +            }
 +
 +            if (match_splits)
 +                return g_list_prepend (match_splits, split);
 +        }
 +    }
 +
 +    return NULL;
 +}
 +
 +
 +static gboolean
 +gncScrubLotDanglingPayments (GNCLot *lot)
 +{
 +    SplitList * split_list, *filtered_list = NULL, *match_list = NULL, *node;
 +    Split *ll_split = gnc_lot_get_earliest_split (lot);
 +    Transaction *ll_trans = xaccSplitGetParent (ll_split);
 +    gnc_numeric ll_val = xaccSplitGetValue (ll_split);
 +    time64 ll_date = xaccTransGetDate (ll_trans);
 +    const char *ll_desc = xaccTransGetDescription (ll_trans);
 +
 +    // look for free splits (i.e. not in any lot) which,
 +    // compared to the lot link split
 +    // - have the same date
 +    // - have the same description
 +    // - have an opposite sign amount
 +    // - free split's abs value is less than or equal to ll split's abs value
 +    split_list = xaccAccountGetSplitList(gnc_lot_get_account (lot));
 +    for (node = split_list; node; node = node->next)
 +    {
 +        Split *free_split = node->data;
 +        Transaction *free_trans;
 +        gnc_numeric free_val;
 +
 +        if (NULL != xaccSplitGetLot(free_split))
 +            continue;
 +
 +        free_trans = xaccSplitGetParent (free_split);
 +        if (ll_date != xaccTransGetDate (free_trans))
 +            continue;
 +
 +        if (0 != g_strcmp0 (ll_desc, xaccTransGetDescription (free_trans)))
 +            continue;
 +
 +        free_val = xaccSplitGetValue (free_split);
 +        if (gnc_numeric_positive_p (ll_val) ==
 +            gnc_numeric_positive_p (free_val))
 +            continue;
 +
 +        if (gnc_numeric_compare (gnc_numeric_abs (free_val), gnc_numeric_abs (ll_val)) > 0)
 +            continue;
 +
 +        filtered_list = g_list_append(filtered_list, free_split);
 +    }
 +
 +    match_list = gncSLFindOffsSplits (filtered_list, ll_val);
 +    g_list_free (filtered_list);
 +
 +    for (node = match_list; node; node = node->next)
 +    {
 +        Split *match_split = node->data;
 +        gnc_lot_add_split (lot, match_split);
 +    }
 +
 +    if (match_list)
 +    {
 +        g_list_free (match_list);
 +        return TRUE;
 +    }
 +    else
 +        return FALSE;
 +}
 +
 +static gboolean
 +gncScrubLotIsSingleLotLinkSplit (GNCLot *lot)
 +{
 +    Split *split = NULL;
 +    Transaction *trans = NULL;
 +
 +    // Lots with a single split which is also a lot link transaction split
 +    // may be sign of a dangling payment. Let's try to fix that
 +
 +    // Only works for single split lots...
 +    if (1 != gnc_lot_count_splits (lot))
 +        return FALSE;
 +
 +    split = gnc_lot_get_earliest_split (lot);
 +    trans = xaccSplitGetParent (split);
 +
 +    if (!trans)
 +    {
 +        // Ooops - the split doesn't belong to any transaction !
 +        // This is not expected so issue a warning and continue with next split
 +        PWARN("Encountered a split in a business lot that's not part of any transaction. "
 +              "This is unexpected! Skipping split %p.", split);
 +        return FALSE;
 +    }
 +
 +    // Only works if single split belongs to a lot link transaction...
 +    if (xaccTransGetTxnType (trans) != TXN_TYPE_LINK)
 +        return FALSE;
 +
 +    return TRUE;
 +}
 +
 +gboolean
 +gncScrubBusinessLot (GNCLot *lot)
 +{
 +    gboolean splits_deleted = FALSE;
 +    gboolean dangling_payments = FALSE;
 +    gboolean dangling_lot_link = FALSE;
 +    Account *acc;
 +    gchar *lotname=NULL;
 +
 +    if (!lot) return FALSE;
 +    lotname = g_strdup (gnc_lot_get_title (lot));
 +    ENTER ("(lot=%p) %s", lot, lotname ? lotname : "(no lotname)");
 +
 +    acc = gnc_lot_get_account (lot);
 +    if (acc)
 +        xaccAccountBeginEdit(acc);
 +
 +    /* Check invoice link consistency
 +     * A lot should have both or neither of:
 +     * - one split from an invoice transaction
 +     * - an invoice-guid set
 +     */
 +    gncScrubInvoiceState (lot);
 +
 +    // Scrub lot links.
 +    // They should only remain when two document lots are linked together
 +    xaccScrubMergeLotSubSplits (lot, FALSE);
 +    splits_deleted = gncScrubLotLinks (lot);
 +
 +    // Look for dangling payments and repair if found
 +    dangling_lot_link = gncScrubLotIsSingleLotLinkSplit (lot);
 +    if (dangling_lot_link)
 +    {
 +        dangling_payments = gncScrubLotDanglingPayments (lot);
 +        if (dangling_payments)
 +            splits_deleted |= gncScrubLotLinks (lot);
 +        else
 +        {
 +            Split *split = gnc_lot_get_earliest_split (lot);
 +            Transaction *trans = xaccSplitGetParent (split);
 +            xaccTransDestroy (trans);
 +        }
 +    }
 +
 +    // If lot is empty now, delete it
 +    if (0 == gnc_lot_count_splits (lot))
 +    {
 +        PINFO("All splits were removed from lot, deleting");
 +        gnc_lot_destroy (lot);
 +    }
 +
 +    if (acc)
 +        xaccAccountCommitEdit(acc);
 +
 +    LEAVE ("(lot=%s, deleted=%d, dangling lot link=%d, dangling_payments=%d)",
 +            lotname ? lotname : "(no lotname)", splits_deleted, dangling_lot_link,
 +            dangling_payments);
 +    g_free (lotname);
 +
 +    return splits_deleted;
 +}
 +
 +gboolean
 +gncScrubBusinessSplit (Split *split)
 +{
-     const gchar *memo = _("Please delete this transaction. Explanation at http://wiki.gnucash.org/wiki/Business_Features_Issues#Double_Posting");
++    const gchar *memo = _("Please delete this transaction. Explanation at https://wiki.gnucash.org/wiki/Business_Features_Issues#Double_posting");
 +    Transaction *txn;
 +    gboolean deleted_split = FALSE;
 +
 +    if (!split) return FALSE;
 +    ENTER ("(split=%p)", split);
 +
 +    txn = xaccSplitGetParent (split);
 +    if (txn)
 +    {
 +        gchar txntype = xaccTransGetTxnType (txn);
 +        const gchar *read_only = xaccTransGetReadOnly (txn);
 +        gboolean is_void = xaccTransGetVoidStatus (txn);
 +        GNCLot *lot = xaccSplitGetLot (split);
 +
 +        /* Look for transactions as a result of double posting an invoice or bill
 +         * Refer to https://bugzilla.gnome.org/show_bug.cgi?id=754209
 +         * to learn how this could have happened in the past.
 +         * Characteristics of such transaction are:
 +         * - read only
 +         * - not voided (to ensure read only is set by the business functions)
 +         * - transaction type is none (should be type invoice for proper post transactions)
 +         * - assigned to a lot
 +         */
 +        if ((txntype == TXN_TYPE_NONE) && read_only && !is_void && lot)
 +        {
 +            gchar *txn_date = qof_print_date (xaccTransGetDateEntered (txn));
 +            xaccTransClearReadOnly (txn);
 +            xaccSplitSetMemo (split, memo);
 +            gnc_lot_remove_split (lot, split);
 +            PWARN("Cleared double post status of transaction \"%s\", dated %s. "
 +                  "Please delete transaction and verify balance.",
 +                  xaccTransGetDescription (txn),
 +                  txn_date);
 +            g_free (txn_date);
 +        }
 +        /* Next delete any empty splits that aren't part of an invoice transaction
 +         * Such splits may be the result of scrubbing the business lots, which can
 +         * merge splits together while reducing superfluous lot links
 +         */
 +        else if (gnc_numeric_zero_p (xaccSplitGetAmount(split)) && !gncInvoiceGetInvoiceFromTxn (txn))
 +        {
 +            GNCLot *lot = xaccSplitGetLot (split);
 +            time64 pdate = xaccTransGetDate (txn);
 +            gchar *pdatestr = gnc_ctime (&pdate);
 +            PINFO ("Destroying empty split %p from transaction %s (%s)", split, pdatestr, xaccTransGetDescription(txn));
 +            xaccSplitDestroy (split);
 +
 +            // Also delete the lot containing this split if it was the last split in that lot
 +            if (lot && (gnc_lot_count_splits (lot) == 0))
 +                gnc_lot_destroy (lot);
 +
 +            deleted_split = TRUE;
 +        }
 +
 +    }
 +
 +    LEAVE ("(split=%p)", split);
 +    return deleted_split;
 +}
 +
 +/* ============================================================== */
 +
 +void
 +gncScrubBusinessAccountLots (Account *acc, QofPercentageFunc percentagefunc)
 +{
 +    LotList *lots, *node;
 +    gint lot_count = 0;
 +    gint curr_lot_no = 0;
 +    const gchar *str;
 +    const char *message = _( "Checking business lots in account %s: %u of %u");
 +
 +    if (!acc) return;
 +    if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
 +
 +    str = xaccAccountGetName(acc);
 +    str = str ? str : "(null)";
 +
 +    ENTER ("(acc=%s)", str);
 +    PINFO ("Cleaning up superfluous lot links in account %s \n", str);
 +    xaccAccountBeginEdit(acc);
 +
 +    lots = xaccAccountGetLotList(acc);
 +    lot_count = g_list_length (lots);
 +    for (node = lots; node; node = node->next)
 +    {
 +        GNCLot *lot = node->data;
 +
 +        PINFO("Start processing lot %d of %d",
 +              curr_lot_no + 1, lot_count);
 +
 +        if (curr_lot_no % 100 == 0)
 +        {
 +            char *progress_msg = g_strdup_printf (message, str, curr_lot_no, lot_count);
 +            (percentagefunc)(progress_msg, (100 * curr_lot_no) / lot_count);
 +            g_free (progress_msg);
 +        }
 +
 +        if (lot)
 +            gncScrubBusinessLot (lot);
 +
 +        PINFO("Finished processing lot %d of %d",
 +              curr_lot_no + 1, lot_count);
 +        curr_lot_no++;
 +    }
 +    g_list_free(lots);
 +    xaccAccountCommitEdit(acc);
 +    (percentagefunc)(NULL, -1.0);
 +    LEAVE ("(acc=%s)", str);
 +}
 +
 +/* ============================================================== */
 +
 +void
 +gncScrubBusinessAccountSplits (Account *acc, QofPercentageFunc percentagefunc)
 +{
 +    SplitList *splits, *node;
 +    gint split_count = 0;
 +    gint curr_split_no;
 +    const gchar *str;
 +    const char *message = _( "Checking business splits in account %s: %u of %u");
 +
 +    if (!acc) return;
 +    if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
 +
 +    str = xaccAccountGetName(acc);
 +    str = str ? str : "(null)";
 +
 +    ENTER ("(acc=%s)", str);
 +    PINFO ("Cleaning up superfluous lot links in account %s \n", str);
 +    xaccAccountBeginEdit(acc);
 +
 +restart:
 +    curr_split_no = 0;
 +    splits = xaccAccountGetSplitList(acc);
 +    split_count = g_list_length (splits);
 +    for (node = splits; node; node = node->next)
 +    {
 +        Split *split = node->data;
 +
 +        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, str, curr_split_no, split_count);
 +            (percentagefunc)(progress_msg, (100 * curr_split_no) / split_count);
 +            g_free (progress_msg);
 +        }
 +
 +        if (split)
 +            // If gncScrubBusinessSplit returns true, a split was deleted and hence
 +            // The account split list has become invalid, so we need to start over
 +            if (gncScrubBusinessSplit (split))
 +                goto restart;
 +
 +        PINFO("Finished processing split %d of %d",
 +              curr_split_no + 1, split_count);
 +        curr_split_no++;
 +    }
 +    xaccAccountCommitEdit(acc);
 +    (percentagefunc)(NULL, -1.0);
 +    LEAVE ("(acc=%s)", str);
 +}
 +
 +/* ============================================================== */
 +
 +void
 +gncScrubBusinessAccount (Account *acc, QofPercentageFunc percentagefunc)
 +{
 +    if (!acc) return;
 +    if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
 +
 +    gncScrubBusinessAccountLots (acc, percentagefunc);
 +    gncScrubBusinessAccountSplits (acc, percentagefunc);
 +}
 +
 +/* ============================================================== */
 +
 +static void
 +lot_scrub_cb (Account *acc, gpointer data)
 +{
 +    if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
 +    gncScrubBusinessAccount (acc, data);
 +}
 +
 +void
 +gncScrubBusinessAccountTree (Account *acc, QofPercentageFunc percentagefunc)
 +{
 +    if (!acc) return;
 +
 +    gnc_account_foreach_descendant(acc, lot_scrub_cb, percentagefunc);
 +    gncScrubBusinessAccount (acc, percentagefunc);
 +}
 +
 +/* ========================== END OF FILE  ========================= */

commit f888eb88f06fcddff555005f009008971d53541f
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 9 11:22:02 2017 -0800

    Fix with_Python build in cmake.

diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 27a98b6..a5988ae 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -96,7 +96,7 @@ IF(WITH_PYTHON)
     DEPENDS ${SWIG_GNUCASH_CORE_C})
 
   ADD_CUSTOM_TARGET(gnucash-core-c-build ALL
-    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/gnucash/_gnucash_core_c${CMAKE_SHARED_LIBRARY_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/gnucash/_gnucash_core_c${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
     DEPENDS gnucash_core_c)
     
 ENDIF()

commit 179d022d1a74cd77c5a9e1dac156d0fb9b8ffa0f
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 11:29:39 2017 +0000

    Prevent the rename popup from appearing in the dense calendar
    
    If you right mouse on the dense calendar, the treeview pops but also
    the rename page popup. So stop the cascade of the button press event
    when on the dense calendar.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 17d1a53..8b57330 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1311,7 +1311,7 @@ gnc_dense_cal_button_press(GtkWidget *widget,
         dcal->doc = -1;
         gtk_widget_hide(GTK_WIDGET(dcal->transPopup));
     }
-    return FALSE;
+    return TRUE;
 }
 
 static gint

commit 1f4a2e36db04638930f327c0a1783cd58ea2d32f
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 11:28:09 2017 +0000

    Dense calendar popup window of screen at bottom
    
    The get_allocation function was in the wrong place for the button press

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index d268c21..17d1a53 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1292,12 +1292,12 @@ gnc_dense_cal_button_press(GtkWidget *widget,
         // trick with a bit of flicker.
         gtk_window_move(GTK_WINDOW(dcal->transPopup), evt->x_root + 5, evt->y_root + 5);
 
-        gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
-
         populate_hover_window(dcal);
         gtk_widget_queue_resize(GTK_WIDGET(dcal->transPopup));
         gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
 
+        gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
+
         if (evt->x_root + 5 + alloc.width > dcal->screen_width)
             win_xpos = evt->x_root - 2 - alloc.width;
 

commit 54b492ee83affd27896da099bca04994559ddc14
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 10:48:59 2017 +0000

    Add a margin to the Date label

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 7a99058..d268c21 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -338,6 +338,11 @@ gnc_dense_cal_init(GncDenseCal *dcal)
         gtk_widget_set_name (GTK_WIDGET(dcal->transPopup), "dense-cal-popup");
 
         l = gtk_label_new(_("Date: "));
+#if GTK_CHECK_VERSION(3,12,0)
+        gtk_widget_set_margin_start (l, 5);
+#else
+        gtk_widget_set_margin_left (l, 5);
+#endif
         gtk_container_add(GTK_CONTAINER(hbox), l);
         l = gtk_label_new("YY/MM/DD");
         g_object_set_data(G_OBJECT(dcal->transPopup), "dateLabel", l);

commit 4558521980d7d241c68a9af189fe23feb0d96e7e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 10:39:36 2017 +0000

    Don't re-populate dense calendar treeview on every mouse move
    
    The treeview only needs to be re-populated when the mouse moves to a
    different day so test for this.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 9ee8c13..7a99058 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -131,7 +131,7 @@ static gint wheres_this(GncDenseCal *dcal, int x, int y);
 static void recompute_x_y_scales(GncDenseCal *dcal);
 static void recompute_mark_storage(GncDenseCal *dcal);
 static void recompute_extents(GncDenseCal *dcal);
-static void populate_hover_window(GncDenseCal *dcal, gint doc);
+static void populate_hover_window(GncDenseCal *dcal);
 
 static void month_coords(GncDenseCal *dcal, int monthOfCal, GList **outList);
 static void doc_coords(GncDenseCal *dcal, int dayOfCal,
@@ -1197,14 +1197,14 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
 }
 
 static void
-populate_hover_window(GncDenseCal *dcal, gint doc)
+populate_hover_window(GncDenseCal *dcal)
 {
     GtkWidget *w;
     GDate *date;
     static const int MAX_STRFTIME_BUF_LEN = 64;
     gchar strftimeBuf[MAX_STRFTIME_BUF_LEN];
 
-    if (doc >= 0)
+    if (dcal->doc >= 0)
     {
         GObject *o;
         GtkListStore *model;
@@ -1212,7 +1212,7 @@ populate_hover_window(GncDenseCal *dcal, gint doc)
 
         w = GTK_WIDGET(g_object_get_data(G_OBJECT(dcal->transPopup), "dateLabel"));
         date = g_date_new_dmy(1, dcal->month, dcal->year);
-        g_date_add_days(date, doc);
+        g_date_add_days(date, dcal->doc);
         /* Note: the ISO date format (%F or equivalently
          * %Y-%m-%d) is not a good idea here since many
          * locales will want to use a very different date
@@ -1224,7 +1224,7 @@ populate_hover_window(GncDenseCal *dcal, gint doc)
         o = G_OBJECT(dcal->transPopup);
         model = GTK_LIST_STORE(g_object_get_data(o, "model"));
         gtk_list_store_clear(model);
-        for (l = dcal->marks[doc]; l; l = l->next)
+        for (l = dcal->marks[dcal->doc]; l; l = l->next)
         {
             GtkTreeIter iter;
             gdc_mark_data *gdcmd;
@@ -1261,7 +1261,6 @@ gnc_dense_cal_button_press(GtkWidget *widget,
     GdkScreen *screen = gdk_screen_get_default ();
 #endif
     GtkAllocation alloc;
-    gint doc;
     GncDenseCal *dcal = GNC_DENSE_CAL(widget);
     gint win_xpos = evt->x_root + 5;
     gint win_ypos = evt->y_root + 5;
@@ -1276,9 +1275,9 @@ gnc_dense_cal_button_press(GtkWidget *widget,
     dcal->screen_height = gdk_screen_get_height (screen);
 #endif
 
-    doc = wheres_this(dcal, evt->x, evt->y);
+    dcal->doc = wheres_this(dcal, evt->x, evt->y);
     dcal->showPopup = ~(dcal->showPopup);
-    if (dcal->showPopup && doc >= 0)
+    if (dcal->showPopup && dcal->doc >= 0)
     {
         // Do the move twice in case the WM is ignoring the first one
         // because the window hasn't been shown, yet.  The WM is free
@@ -1290,7 +1289,7 @@ gnc_dense_cal_button_press(GtkWidget *widget,
 
         gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
 
-        populate_hover_window(dcal, doc);
+        populate_hover_window(dcal);
         gtk_widget_queue_resize(GTK_WIDGET(dcal->transPopup));
         gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
 
@@ -1303,7 +1302,10 @@ gnc_dense_cal_button_press(GtkWidget *widget,
         gtk_window_move(GTK_WINDOW(dcal->transPopup), win_xpos, win_ypos);
     }
     else
+    {
+        dcal->doc = -1;
         gtk_widget_hide(GTK_WIDGET(dcal->transPopup));
+    }
     return FALSE;
 }
 
@@ -1340,10 +1342,15 @@ gnc_dense_cal_motion_notify(GtkWidget *widget,
     doc = wheres_this(dcal, event->x, event->y);
     if (doc >= 0)
     {
+        if (dcal->doc != doc) // if we are on the same day, no need to reload
+        {
+            dcal->doc = doc;
+            populate_hover_window(dcal);
+            gtk_widget_queue_resize(GTK_WIDGET(dcal->transPopup));
+            gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
+        }
         gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
 
-        gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
-
         if (event->x_root + 5 + alloc.width > dcal->screen_width)
             win_xpos = event->x_root - 2 - alloc.width;
 
@@ -1353,7 +1360,10 @@ gnc_dense_cal_motion_notify(GtkWidget *widget,
         gtk_window_move(GTK_WINDOW(dcal->transPopup), win_xpos, win_ypos);
     }
     else
+    {
+        dcal->doc = -1;
         gtk_widget_hide(GTK_WIDGET(dcal->transPopup));
+    }
     return TRUE;
 }
 
diff --git a/gnucash/gnome-utils/gnc-dense-cal.h b/gnucash/gnome-utils/gnc-dense-cal.h
index 37ee05c..2a71fcf 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.h
+++ b/gnucash/gnome-utils/gnc-dense-cal.h
@@ -59,6 +59,7 @@ struct _GncDenseCal
     GtkWindow *transPopup;
     gint screen_width;
     gint screen_height;
+    gint doc;
 
     gint min_x_scale;
     gint min_y_scale;

commit 9c3247d5ccfbcab4e360fbb0dc967b7ab800a22e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 10:32:10 2017 +0000

    Save the screen dimensions on button click
    
    Instead of getting the dimensions on every mouse move, just save them
    on button click and use the saved values.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 22afcf0..9ee8c13 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1256,26 +1256,24 @@ gnc_dense_cal_button_press(GtkWidget *widget,
 #if GTK_CHECK_VERSION(3,22,0)
     GdkWindow *win = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
     GdkMonitor *mon = gdk_display_get_monitor_at_window (gtk_widget_get_display (widget), win);
-    GdkRectangle monitor_size;
+    GdkRectangle work_area_size;
 #else
     GdkScreen *screen = gdk_screen_get_default ();
 #endif
     GtkAllocation alloc;
     gint doc;
-    gint screen_width;
-    gint screen_height;
     GncDenseCal *dcal = GNC_DENSE_CAL(widget);
     gint win_xpos = evt->x_root + 5;
     gint win_ypos = evt->y_root + 5;
 
 #if GTK_CHECK_VERSION(3,22,0)
-    gdk_monitor_get_geometry (mon, &monitor_size);
+    gdk_monitor_get_workarea (mon, &work_area_size);
 
-    screen_width = monitor_size.width;
-    screen_height = monitor_size.height;
+    dcal->screen_width = work_area_size.width;
+    dcal->screen_height = work_area_size.height;
 #else
-    screen_width = gdk_screen_get_width (screen);
-    screen_height = gdk_screen_get_height (screen);
+    dcal->screen_width = gdk_screen_get_width (screen);
+    dcal->screen_height = gdk_screen_get_height (screen);
 #endif
 
     doc = wheres_this(dcal, evt->x, evt->y);
@@ -1296,10 +1294,10 @@ gnc_dense_cal_button_press(GtkWidget *widget,
         gtk_widget_queue_resize(GTK_WIDGET(dcal->transPopup));
         gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
 
-        if (evt->x_root + 5 + alloc.width > screen_width)
+        if (evt->x_root + 5 + alloc.width > dcal->screen_width)
             win_xpos = evt->x_root - 2 - alloc.width;
 
-        if (evt->y_root + 5 + alloc.height > screen_height)
+        if (evt->y_root + 5 + alloc.height > dcal->screen_height)
             win_ypos = evt->y_root - 2 - alloc.height;
 
         gtk_window_move(GTK_WINDOW(dcal->transPopup), win_xpos, win_ypos);
@@ -1313,12 +1311,9 @@ static gint
 gnc_dense_cal_motion_notify(GtkWidget *widget,
                             GdkEventMotion *event)
 {
-    GdkScreen *screen = gdk_screen_get_default ();
     GncDenseCal *dcal;
     GtkAllocation alloc;
     gint doc;
-    gint screen_width;
-    gint screen_height;
     int unused;
     GdkModifierType unused2;
     gint win_xpos = event->x_root + 5;
@@ -1345,30 +1340,14 @@ gnc_dense_cal_motion_notify(GtkWidget *widget,
     doc = wheres_this(dcal, event->x, event->y);
     if (doc >= 0)
     {
-#if GTK_CHECK_VERSION(3,22,0)
-        GdkWindow *win = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
-        GdkMonitor *mon = gdk_display_get_monitor_at_window (gtk_widget_get_display (widget), win);
-        GdkRectangle monitor_size;
-
-        gdk_monitor_get_geometry (mon, &monitor_size);
-
-        screen_width = monitor_size.width;
-        screen_height = monitor_size.height;
-#else
-        screen_width = gdk_screen_get_width (screen);
-        screen_height = gdk_screen_get_height (screen);
-#endif
-        populate_hover_window(dcal, doc);
-        gtk_widget_queue_resize(GTK_WIDGET(dcal->transPopup));
-
         gtk_widget_get_allocation(GTK_WIDGET(dcal->transPopup), &alloc);
 
         gtk_widget_show_all(GTK_WIDGET(dcal->transPopup));
 
-        if (event->x_root + 5 + alloc.width > screen_width)
+        if (event->x_root + 5 + alloc.width > dcal->screen_width)
             win_xpos = event->x_root - 2 - alloc.width;
 
-        if (event->y_root + 5 + alloc.height > screen_height)
+        if (event->y_root + 5 + alloc.height > dcal->screen_height)
             win_ypos = event->y_root - 2 - alloc.height;
 
         gtk_window_move(GTK_WINDOW(dcal->transPopup), win_xpos, win_ypos);
diff --git a/gnucash/gnome-utils/gnc-dense-cal.h b/gnucash/gnome-utils/gnc-dense-cal.h
index 5bedd6e..37ee05c 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.h
+++ b/gnucash/gnome-utils/gnc-dense-cal.h
@@ -57,6 +57,8 @@ struct _GncDenseCal
 
     gboolean showPopup;
     GtkWindow *transPopup;
+    gint screen_width;
+    gint screen_height;
 
     gint min_x_scale;
     gint min_y_scale;

commit 9253b5021016bb2e964dc65c5228020e9ac2c77e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Nov 9 10:12:52 2017 +0000

    If there are no marked days on Windows the dense calendar crashes
    
    If there are no marked days in the dense calendar add a blank one. Also
    make sure all pending events are processed be fore returning as the
    treeview did not always populate correctly.

diff --git a/gnucash/gnome-utils/gnc-dense-cal.c b/gnucash/gnome-utils/gnc-dense-cal.c
index 90355a4..22afcf0 100644
--- a/gnucash/gnome-utils/gnc-dense-cal.c
+++ b/gnucash/gnome-utils/gnc-dense-cal.c
@@ -1234,6 +1234,17 @@ populate_hover_window(GncDenseCal *dcal, gint doc)
             gtk_list_store_set(model, &iter, 0, (gdcmd->name ? gdcmd->name : _("(unnamed)")), 1, gdcmd->info, -1);
         }
 
+        // if there are no rows, add one
+        if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL(model), NULL) == 0)
+        {
+            GtkTreeIter iter;
+            gtk_list_store_insert(model, &iter, -1);
+        }
+
+        // make sure all pending events are processed
+        while(gtk_events_pending())
+            gtk_main_iteration();
+
         g_date_free(date);
     }
 }

commit 45bab93613e6a93b206b74ffc18f63708b07293b
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 7 18:06:04 2017 -0800

    Bug 789928 - FTBFS with libdbi 0.9.0-5 on Debian
    
    Commit 88b8477 on libdbi calls the error handler if one attempts to run
    off the end of a result set. Since we often loop on
    dbi_result_next_row() returning 0 this breaks our logic in several
    places. This change simply returns from the error handler on a
    DB_ERROR_BADIDX allowing the logic to work as before.

diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c
index 912a9fa..bfb50a0 100644
--- a/src/backend/dbi/gnc-backend-dbi.c
+++ b/src/backend/dbi/gnc-backend-dbi.c
@@ -396,8 +396,13 @@ sqlite3_error_fn( dbi_conn conn, /*@ unused @*/ void* user_data )
     const gchar* msg;
     GncDbiBackend *be = (GncDbiBackend*)user_data;
     GncDbiSqlConnection *dbi_conn = (GncDbiSqlConnection*)(be->sql_be.conn);
-
-    (void)dbi_conn_error( conn, &msg );
+    int err_num = dbi_conn_error( conn, &msg );
+    /* BADIDX is raised if we attempt to seek outside of a result. We
+     * handle that possibility after checking the return value of the
+     * seek. Having this raise a critical error breaks looping by
+     * testing for the return value of the seek.
+     */
+    if (err_num == DBI_ERROR_BADIDX) return;
     PERR( "DBI error: %s\n", msg );
     gnc_dbi_set_error( dbi_conn, ERR_BACKEND_MISC, 0, FALSE );
 }
@@ -611,14 +616,18 @@ mysql_error_fn( dbi_conn conn, void* user_data )
     GncDbiBackend *be = (GncDbiBackend*)user_data;
     GncDbiSqlConnection *dbi_conn = (GncDbiSqlConnection*)be->sql_be.conn;
     const gchar* msg;
-    gint err_num;
 #ifdef G_OS_WIN32
     const guint backoff_msecs = 1;
 #else
     const guint backoff_usecs = 1000;
 #endif
-
-    err_num = dbi_conn_error( conn, &msg );
+    int err_num = dbi_conn_error( conn, &msg );
+    /* BADIDX is raised if we attempt to seek outside of a result. We
+     * handle that possibility after checking the return value of the
+     * seek. Having this raise a critical error breaks looping by
+     * testing for the return value of the seek.
+     */
+    if (err_num == DBI_ERROR_BADIDX) return;
 
     /* Note: the sql connection may not have been initialized yet
      *       so let's be careful with using it
@@ -1331,8 +1340,14 @@ pgsql_error_fn( dbi_conn conn, void* user_data )
 #else
     const guint backoff_usecs = 1000;
 #endif
+    int err_num = dbi_conn_error( conn, &msg );
+    /* BADIDX is raised if we attempt to seek outside of a result. We
+     * handle that possibility after checking the return value of the
+     * seek. Having this raise a critical error breaks looping by
+     * testing for the return value of the seek.
+     */
+    if (err_num == DBI_ERROR_BADIDX) return;
 
-    (void)dbi_conn_error( conn, &msg );
     if ( g_str_has_prefix( msg, "FATAL:  database" ) &&
             g_str_has_suffix( msg, "does not exist\n" ) )
     {

commit f9d5436adc0fe031e0e6d16f7a9919a43ca10b8d
Merge: 6c01e54 3b0bcf7
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Nov 7 15:47:57 2017 -0800

    Merge J. Marino's 'fix-negative-colors' into unstable.


commit 6c01e540424ca69b852ee648b882f5bdcee708b9
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Oct 31 16:33:08 2017 -0700

    Convert shell-executed scheme tests to run directly from Guile.
    
    I.e., remove the shell invocation and with it the need to set the shebang.
    
    Surprisingly this required some build-system modifications particularly
    for cmake in order to correctly set the environment.

diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
index 3ad98bc..ffe31f1 100644
--- a/common/cmake_modules/GncAddSchemeTargets.cmake
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -162,7 +162,7 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
            ${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}")
diff --git a/common/cmake_modules/MakeDistFiles.cmake b/common/cmake_modules/MakeDistFiles.cmake
index 9fc7e46..405c87d 100644
--- a/common/cmake_modules/MakeDistFiles.cmake
+++ b/common/cmake_modules/MakeDistFiles.cmake
@@ -44,7 +44,6 @@ SET(COPY_FROM_BUILD
   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/gnucash.rc
   gnucash/overrides/gnucash-make-guids
@@ -55,31 +54,18 @@ SET(COPY_FROM_BUILD
   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
diff --git a/configure.ac b/configure.ac
index c77e51b..a725f93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1777,42 +1777,10 @@ AC_CONFIG_FILES(
   dnl # init-commands go here
 )
 dnl # Shell scripts, to have their shells set
-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/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],
-                [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([gnucash/overrides/gnucash-make-guids], [chmod u+x gnucash/overrides/gnucash-make-guids])
diff --git a/gnucash/gnome-utils/test/CMakeLists.txt b/gnucash/gnome-utils/test/CMakeLists.txt
index 647c61c..eab5563 100644
--- a/gnucash/gnome-utils/test/CMakeLists.txt
+++ b/gnucash/gnome-utils/test/CMakeLists.txt
@@ -27,9 +27,22 @@ SET(GNOME_UTILS_GUI_TEST_LIBS
 #  GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
 #  GNOME_UTILS_GUI_TEST_LIBS
 #
+SET(GUILE_DEPENDS
+  test-core
+  gncmod-test-engine
+  gncmod-app-utils
+  gnc-core-utils
+  gncmod-engine
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-test-load-gnome-utils-module
+  "test-load-gnome-utils-module.scm"
+  "gnucash/reports"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
 
-GNC_ADD_SCHEME_TEST(test-load-module-gnome-utils test-load-module.in)
+GNC_ADD_SCHEME_TESTS(test-load-gnome-utils-module.scm)
 
-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)
+SET_DIST_LIST(test_gnome_utils_DIST CMakeLists.txt Makefile.am test-gnc-recurrence.c test-link-module.c test-load-report-gnome-module.scm)
diff --git a/gnucash/gnome-utils/test/Makefile.am b/gnucash/gnome-utils/test/Makefile.am
index f06d47b..1d88c2e 100644
--- a/gnucash/gnome-utils/test/Makefile.am
+++ b/gnucash/gnome-utils/test/Makefile.am
@@ -1,5 +1,5 @@
 TESTS =  \
-  test-link-module test-load-module
+  test-link-module ${SCM_TESTS}
 
 # The following tests are nice, but have absolutely no place in an
 # automated testing system.
@@ -67,8 +67,17 @@ test_link_module_LDADD = \
   ${GLIB_LIBS} \
   ${top_builddir}/libgnucash/gnc-module/libgnc-module.la
 
+SCM_TESTS =   test-load-gnome-utils-module
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
+	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 $@
+
 EXTRA_DIST = \
-  test-load-module \
+  ${SCM_TEST_SRCS} \
   CMakeLists.txt
 
 testit:
diff --git a/gnucash/gnome-utils/test/test-load-module.in b/gnucash/gnome-utils/test/test-load-gnome-utils-module.scm
similarity index 89%
rename from gnucash/gnome-utils/test/test-load-module.in
rename to gnucash/gnome-utils/test/test-load-gnome-utils-module.scm
index 6d214ac..530eb66 100755
--- a/gnucash/gnome-utils/test/test-load-module.in
+++ b/gnucash/gnome-utils/test/test-load-gnome-utils-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@ 
-exec ${GUILE} -s $0
-!#
-
 (setenv "GNC_UNINSTALLED" "1")
 (use-modules (gnucash gnc-module))
 (gnc:module-system-init)
diff --git a/gnucash/register/register-core/test/Makefile.am b/gnucash/register/register-core/test/Makefile.am
index 84387df..b9b3407 100644
--- a/gnucash/register/register-core/test/Makefile.am
+++ b/gnucash/register/register-core/test/Makefile.am
@@ -1,6 +1,5 @@
 TESTS =  \
   test-link-module
-#  test-load-module
 
 #GNC_TEST_DEPS := \
 #
@@ -19,6 +18,5 @@ test_link_module_LDADD=\
   ../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/gnucash/register/register-gnome/test/Makefile.am b/gnucash/register/register-gnome/test/Makefile.am
index 2a7a65f..f04642a 100644
--- a/gnucash/register/register-gnome/test/Makefile.am
+++ b/gnucash/register/register-gnome/test/Makefile.am
@@ -1,6 +1,5 @@
 TESTS =  \
   test-link-module
-#  test-load-module
 
 #GNC_TEST_DEPS := \
 #
@@ -19,6 +18,5 @@ test_link_module_LDADD = \
   ../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/gnucash/report/locale-specific/us/test/CMakeLists.txt b/gnucash/report/locale-specific/us/test/CMakeLists.txt
index f4d351c..d5db185 100644
--- a/gnucash/report/locale-specific/us/test/CMakeLists.txt
+++ b/gnucash/report/locale-specific/us/test/CMakeLists.txt
@@ -6,8 +6,19 @@ GNC_ADD_TEST(test-link-module-report-locale-specific-us test-link-module.c
 )
 
 # This test not run in the autotools build.
-#GNC_ADD_SCHEME_TEST(test-load-module-report-locale-specific-us
-#  test-load-module.in
+#SET(GUILE_DEPENDS
+#  gncmod-app-utils
+#  gnc-core-utils
+#  gnc-module
+#  gncmod-engine
 #)
+#
+#GNC_ADD_SCHEME_TARGETS(test-load-report-locale-specific-module
+#  "test-load-report-locale-specific-module.scm"
+#  "gnucash/report"
+#  "${GUILE_DEPENDS}"
+#  FALSE
+#  )
+#GNC_ADD_SCHEME_TESTS(test-load-report-locale-specific-us-module.scm)
 
-SET_DIST_LIST(test_locale_specific_us_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-module.in)
\ No newline at end of file
+SET_DIST_LIST(test_locale_specific_us_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-report-locale-specific-module.scm)
diff --git a/gnucash/report/locale-specific/us/test/test-load-module.in b/gnucash/report/locale-specific/us/test/test-load-report-locale-specific-module.scm
similarity index 91%
rename from gnucash/report/locale-specific/us/test/test-load-module.in
rename to gnucash/report/locale-specific/us/test/test-load-report-locale-specific-module.scm
index f78ce92..e1e1b0a 100755
--- a/gnucash/report/locale-specific/us/test/test-load-module.in
+++ b/gnucash/report/locale-specific/us/test/test-load-report-locale-specific-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@ 
-exec ${GUILE} -s $0
-!#
-
 (use-modules (gnucash gnc-module))
 (gnc:module-system-init)
 
@@ -16,4 +12,3 @@ exec ${GUILE} -s $0
     (begin 
       (display "failed\n")
       (exit -1)))
-
diff --git a/gnucash/report/report-gnome/test/CMakeLists.txt b/gnucash/report/report-gnome/test/CMakeLists.txt
index a20af2f..7005e96 100644
--- a/gnucash/report/report-gnome/test/CMakeLists.txt
+++ b/gnucash/report/report-gnome/test/CMakeLists.txt
@@ -9,11 +9,21 @@ 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
+SET(GUILE_DEPENDS
+  scm-app-utils
+  gncmod-gnome-utils
+  gnc-module
+  gncmod-engine
+  gncmod-report-gnome
 )
 
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
+GNC_ADD_SCHEME_TARGETS(scm-test-load-report-gnome-module
+  "test-load-report-gnome-module.scm"
+  "gnucash/reports"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+GNC_ADD_SCHEME_TESTS(test-load-report-gnome-module.scm)
 
-SET_DIST_LIST(test_report_gnome_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-module.in)
+SET_DIST_LIST(test_report_gnome_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-report-gnome-module.scm)
 
diff --git a/gnucash/report/report-gnome/test/Makefile.am b/gnucash/report/report-gnome/test/Makefile.am
index 648f412..fb66d7b 100644
--- a/gnucash/report/report-gnome/test/Makefile.am
+++ b/gnucash/report/report-gnome/test/Makefile.am
@@ -18,7 +18,7 @@ LDADD = \
 
 TESTS = \
   test-link-module \
-  test-load-module
+  ${SCM_TESTS}
 
 GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
   --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
@@ -60,6 +60,15 @@ TESTS_ENVIRONMENT = \
   $(shell ${abs_top_srcdir}/common/gnc-test-env.pl --noexports ${GNC_TEST_DEPS})
 
 
+SCM_TESTS =   test-load-report-gnome-module
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
+	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 $@
+
 check_PROGRAMS = test-link-module
 
-EXTRA_DIST = test-load-module CMakeLists.txt
+EXTRA_DIST = ${SCM_TEST_SRCS} CMakeLists.txt
diff --git a/gnucash/report/report-gnome/test/test-load-module.in b/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
similarity index 100%
rename from gnucash/report/report-gnome/test/test-load-module.in
rename to gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
index fc03bc7..e76d828 100644
--- a/gnucash/report/report-system/test/CMakeLists.txt
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -10,6 +10,7 @@ GNC_ADD_TEST_WITH_GUILE(test-link-module-report-system test-link-module.c
 )
 
 SET(scm_test_report_system_SOURCES
+  test-load-report-system-module.scm
   test-collectors.scm
   test-list-extras.scm
   test-report-utilities.scm
@@ -17,7 +18,6 @@ SET(scm_test_report_system_SOURCES
   )
 
 GNC_ADD_SCHEME_TESTS(${scm_test_report_system_SOURCES})
-GNC_ADD_SCHEME_TEST(test-load-module-report-system test-load-module.in)
 
 GNC_ADD_SCHEME_TARGETS(scm-test-report-system
   "test-extras.scm"
@@ -33,7 +33,13 @@ GNC_ADD_SCHEME_TARGETS(scm-test-report-system-2
   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)
+SET_DIST_LIST(test_report_system_DIST
+  CMakeLists.txt
+  Makefile.am
+  test-collectors.scm
+  test-extras.scm
+  test-link-module.c
+  test-report-utilities.scm
+  test-list-extras.scm
+)
diff --git a/gnucash/report/report-system/test/Makefile.am b/gnucash/report/report-system/test/Makefile.am
index fcdd1fe..b79dadc 100644
--- a/gnucash/report/report-system/test/Makefile.am
+++ b/gnucash/report/report-system/test/Makefile.am
@@ -15,10 +15,10 @@ LDADD = \
 
 TESTS = \
   test-link-module \
-  test-load-module \
   $(SCM_TESTS)
 
 SCM_TESTS = \
+        test-load-report-system-module \
 	test-collectors \
 	test-list-extras \
 	test-report-utilities
@@ -74,7 +74,6 @@ check_PROGRAMS = test-link-module
 SCM_TEST_HELPERS = test-extras.scm
 
 EXTRA_DIST = \
-	test-load-module \
 	$(SCM_TEST_HELPERS) \
 	$(SCM_TEST_SRCS) \
 	CMakeLists.txt
diff --git a/gnucash/report/report-system/test/test-load-module.in b/gnucash/report/report-system/test/test-load-report-system-module.scm
similarity index 91%
rename from gnucash/report/report-system/test/test-load-module.in
rename to gnucash/report/report-system/test/test-load-report-system-module.scm
index c4c3f42..ea77251 100755
--- a/gnucash/report/report-system/test/test-load-module.in
+++ b/gnucash/report/report-system/test/test-load-report-system-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@ 
-exec ${GUILE} -s "$0"
-!#
-
 (debug-enable 'debug)
 (debug-enable 'backtrace)
 
@@ -23,7 +19,3 @@ exec ${GUILE} -s "$0"
     (begin 
       (display "failed\n")
       (exit -1)))
-
-
- 
-
diff --git a/gnucash/report/standard-reports/test/CMakeLists.txt b/gnucash/report/standard-reports/test/CMakeLists.txt
index 6840203..0692020 100644
--- a/gnucash/report/standard-reports/test/CMakeLists.txt
+++ b/gnucash/report/standard-reports/test/CMakeLists.txt
@@ -1,17 +1,30 @@
 SET(scm_test_standard_reports_SOURCES
   test-cash-flow.scm
   test-cashflow-barchart.scm
+  test-standard-category-report.scm
+  test-standard-net-barchart.scm
+  test-standard-net-linechart.scm
+)
+
+SET(scm_test_report_SUPPORT
   test-generic-category-report.scm
   test-generic-net-barchart.scm
   test-generic-net-linechart.scm
-)
+  )
+
 
-GNC_ADD_SCHEME_TESTS(${scm_test_standard_reports_SOURCES})
+GNC_ADD_SCHEME_TESTS("${scm_test_standard_reports_SOURCES}")
 
+GNC_ADD_SCHEME_TARGETS(scm-test-standard-support
+  "${scm_test_report_SUPPORT}"
+  "gnucash/report/standard-reports/test"
+  "scm-gnc-module;scm-test-report-system;scm-standard-reports;scm-report-stylesheets-2"
+  FALSE
+  )
 GNC_ADD_SCHEME_TARGETS(scm-test-standard-reports
   "${scm_test_standard_reports_SOURCES}"
   gnucash/report/standard-reports/test
-  "scm-gnc-module;scm-test-report-system;scm-standard-reports;scm-report-stylesheets-2"
+  scm-test-standard-support
   FALSE
 )
 
diff --git a/gnucash/report/standard-reports/test/Makefile.am b/gnucash/report/standard-reports/test/Makefile.am
index 78ebd09..6a14249 100644
--- a/gnucash/report/standard-reports/test/Makefile.am
+++ b/gnucash/report/standard-reports/test/Makefile.am
@@ -7,6 +7,10 @@ SCM_TESTS = \
 	test-standard-net-barchart \
 	test-standard-net-linechart
 
+# test-generic-category-report.scm,test-generic-net-barchart, and
+# test-generic-net-linechart are support files used by the respective
+# test-standard-*
+
 SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
 
 GNC_TEST_DEPS = \
diff --git a/gnucash/report/stylesheets/test/CMakeLists.txt b/gnucash/report/stylesheets/test/CMakeLists.txt
index bcf97c1..5d58607 100644
--- a/gnucash/report/stylesheets/test/CMakeLists.txt
+++ b/gnucash/report/stylesheets/test/CMakeLists.txt
@@ -1,6 +1,24 @@
-CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
-GNC_ADD_SCHEME_TEST(test-load-module-report-stylesheets
-  test-load-module.in
+SET(GUILE_DEPENDS
+  test-core
+  gncmod-app-utils
+  gnc-core-utils
+  gnc-module
+  gncmod-engine
+  gncmod-backend-xml
+  gncmod-backend-xml
+  gncmod-gnome-utils
+  gncmod-html
+  gncmod-report-system
+  gncmod-report-gnome
 )
 
-SET_DIST_LIST(test_stylesheets_DIST CMakeLists.txt Makefile.am test-load-module.in)
\ No newline at end of file
+GNC_ADD_SCHEME_TARGETS(scm-test-load-report-stylesheets-module
+  "test-load-report-stylesheets-module.scm"
+  "gnucash/report"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+
+GNC_ADD_SCHEME_TESTS("test-load-report-stylesheets-module.scm")
+
+SET_DIST_LIST(test_stylesheets_DIST CMakeLists.txt Makefile.am test-load-report-stylesheets-module.scm)
diff --git a/gnucash/report/stylesheets/test/Makefile.am b/gnucash/report/stylesheets/test/Makefile.am
index f3f5c02..998140d 100644
--- a/gnucash/report/stylesheets/test/Makefile.am
+++ b/gnucash/report/stylesheets/test/Makefile.am
@@ -1,4 +1,4 @@
-TESTS=test-load-module
+TESTS = ${SCM_TESTS}
 
 GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
   --gnc-module-dir ${top_builddir}/libgnucash/app-utils \
@@ -35,4 +35,15 @@ TESTS_ENVIRONMENT = \
   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
+SCM_TESTS = test-load-report-stylesheets-module
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
+	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 $@
+
+EXTRA_DIST = \
+  ${SCM_TEST_SRCS} \
+  CMakeLists.txt
diff --git a/gnucash/report/stylesheets/test/test-load-module.in b/gnucash/report/stylesheets/test/test-load-report-stylesheets-module.scm
similarity index 92%
rename from gnucash/report/stylesheets/test/test-load-module.in
rename to gnucash/report/stylesheets/test/test-load-report-stylesheets-module.scm
index 8a58509..2217dba 100755
--- a/gnucash/report/stylesheets/test/test-load-module.in
+++ b/gnucash/report/stylesheets/test/test-load-report-stylesheets-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@ 
-exec ${GUILE} -s "$0"
-!#
-
 (setenv "GNC_UNINSTALLED" "1")
 (display "  testing stylesheet module load ... ")
 (use-modules (gnucash unittest-support))
@@ -17,15 +13,11 @@ exec ${GUILE} -s "$0"
 (gnc:module-system-init)
 
 (if (gnc:module-load "gnucash/report/stylesheets" 0)
-    (begin 
+    (begin
       (g-log-remove-handler log-domain handler)
       (display "ok\n")
       (exit 0))
-    (begin 
+    (begin
       (g-log-remove-handler log-domain handler)
       (display "failed\n")
       (exit -1)))
-
-
- 
-
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index 35bc187..b99b936 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -27,11 +27,34 @@ GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
 )
 ADD_APP_UTILS_TEST(test-sx test-sx.cpp)
 
-GNC_ADD_SCHEME_TEST(scm-test-load-module-app-utils test-load-module.in)
+SET(GUILE_DEPENDS
+  scm-app-utils
+  gnc-core-utils
+  gnc-module
+  gncmod-engine
+  gncmod-backend-xml
+  gncmod-backend-xml
+)
+
+GNC_ADD_SCHEME_TARGETS(scm-test-load-app-utils-module
+  "test-load-app-utils-module.scm"
+  "gnucash/reports"
+  "${GUILE_DEPENDS}"
+  FALSE
+)
+
+GNC_ADD_SCHEME_TESTS("test-load-app-utils-module.scm")
 # Doesn't work yet:
 GNC_ADD_TEST_WITH_GUILE(test-app-utils "${test_app_utils_SOURCES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
 
-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})
+SET_DIST_LIST(test_app_utils_DIST
+  CMakeLists.txt
+  Makefile.am
+  test-exp-parser.c
+  test-link-module.c
+  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
index a5aefc8..5380cc3 100644
--- a/libgnucash/app-utils/test/Makefile.am
+++ b/libgnucash/app-utils/test/Makefile.am
@@ -9,8 +9,8 @@ check_PROGRAMS = \
   test-app-utils
 
 TESTS =  \
-  test-load-module \
-  ${check_PROGRAMS}
+  ${check_PROGRAMS} \
+  ${SCM_TESTS}
 
 test_scm_query_string_SOURCES = test-scm-query-string.cpp
 test_sx_SOURCES = test-sx.cpp
@@ -47,8 +47,8 @@ LDADD = \
    ${GUILE_LIBS}
 
 EXTRA_DIST += \
-  test-load-module \
   test-print-queries.cpp \
+  ${SCM_TEST_SRCS} \
   CMakeLists.txt
 
 AM_CPPFLAGS = \
@@ -73,3 +73,12 @@ test_app_utils_CXXFLAGS = \
 	-I${top_srcdir}/${MODULEPATH}/ \
 	-DTESTPROG=test_app_utils \
 	${GLIB_CFLAGS}
+
+SCM_TESTS =   test-load-app-utils-module
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
+
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
+	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 $@
diff --git a/libgnucash/app-utils/test/test-load-module.in b/libgnucash/app-utils/test/test-load-app-utils-module.scm
similarity index 97%
rename from libgnucash/app-utils/test/test-load-module.in
rename to libgnucash/app-utils/test/test-load-app-utils-module.scm
index 5d6bb0e..6bf102f 100755
--- a/libgnucash/app-utils/test/test-load-module.in
+++ b/libgnucash/app-utils/test/test-load-app-utils-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s "$0" 
-!#
-
 (define exit-code 0)
 (setenv "GNC_UNINSTALLED" "1")
 (use-modules (gnucash gnc-module))
diff --git a/libgnucash/engine/test/CMakeLists.txt b/libgnucash/engine/test/CMakeLists.txt
index 10a6d62..0ffee43 100644
--- a/libgnucash/engine/test/CMakeLists.txt
+++ b/libgnucash/engine/test/CMakeLists.txt
@@ -15,8 +15,6 @@ 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)
@@ -210,23 +208,34 @@ GNC_ADD_TEST(test-import-map "${test_import_map_SOURCES}"
 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(engine_test_SCHEME
+  test-account.scm
+  test-create-account.scm
+  test-test-extras.scm
+  test-split.scm
+  test-test-extras.scm
+  )
+
+#LIST(APPEND engine_test_SCHEME  test-scm-query-import.scm) Fails
 
 SET(GUILE_DEPENDS      scm-app-utils scm-scm)
 
+GNC_ADD_SCHEME_TARGETS(scm-test-engine-extras
+  "test-extras.scm"
+  "gnucash/engine/test/"
+  "${GUILE_DEPENDS}"
+  FALSE
+  )
+
 GNC_ADD_SCHEME_TARGETS(scm-test-engine
   "${engine_test_SCHEME}"
-  gnucash/engine/test
-  "${GUILE_DEPENDS}"
+  ""
+  "${GUILE_DEPENDS};scm-test-engine-extras"
   FALSE
-)
+  )
+
+GNC_ADD_SCHEME_TESTS("${engine_test_SCHEME}")
 
 SET(test_engine_SOURCES_DIST
         dummy.cpp
@@ -292,8 +301,6 @@ SET(test_engine_SCHEME_DIST
 
 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
diff --git a/libgnucash/engine/test/Makefile.am b/libgnucash/engine/test/Makefile.am
index 6210fbb..94a7a33 100644
--- a/libgnucash/engine/test/Makefile.am
+++ b/libgnucash/engine/test/Makefile.am
@@ -56,9 +56,11 @@ TEST_GROUP_2 = \
   test-vendor
 
 SCM_TESTS = \
+  test-create-account \
   test-test-extras \
   test-account \
   test-split
+#  test-scm-query-import \ Fails
 
 SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
 
@@ -107,7 +109,7 @@ TESTS_ENVIRONMENT = \
 
 check_PROGRAMS = ${TEST_GROUP_1} ${TEST_GROUP_2}
 
-TESTS = ${TEST_GROUP_1} test-create-account ${TEST_GROUP_2} ${SCM_TESTS}
+TESTS = ${TEST_GROUP_1} ${TEST_GROUP_2} ${SCM_TESTS}
 
 test_link_SOURCES = test-link.c
 test_link_LDADD = ../libgncmod-engine.la \
@@ -120,10 +122,6 @@ 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
diff --git a/libgnucash/engine/test/test-create-account.in b/libgnucash/engine/test/test-create-account.in
deleted file mode 100755
index a9db9aa..0000000
--- a/libgnucash/engine/test/test-create-account.in
+++ /dev/null
@@ -1,2 +0,0 @@
-#!@SHELL@
-${GUILE} -l $SRCDIR/test-create-account.scm -c "(exit (run-test))"
diff --git a/libgnucash/engine/test/test-scm-query-import.in b/libgnucash/engine/test/test-scm-query-import.in
deleted file mode 100755
index 5094d76..0000000
--- a/libgnucash/engine/test/test-scm-query-import.in
+++ /dev/null
@@ -1,2 +0,0 @@
-#!@SHELL@
-${GUILE} -l $SRCDIR/test-scm-query-import.scm -c "(exit (run-test))"
diff --git a/libgnucash/gnc-module/CMakeLists.txt b/libgnucash/gnc-module/CMakeLists.txt
index 250fd55..ae9bd03 100644
--- a/libgnucash/gnc-module/CMakeLists.txt
+++ b/libgnucash/gnc-module/CMakeLists.txt
@@ -54,7 +54,7 @@ SET(GUILE_DEPENDS      gnc-module)
 
 GNC_ADD_SCHEME_TARGETS(scm-gnc-module
   "${gnc_module_SCHEME}"
-  ${GUILE_OUTPUT_DIR} 
+  ${GUILE_OUTPUT_DIR}
   "${GUILE_DEPENDS}"
   FALSE
 )
diff --git a/libgnucash/gnc-module/test/CMakeLists.txt b/libgnucash/gnc-module/test/CMakeLists.txt
index 7bc44d7..a6ab0ee 100644
--- a/libgnucash/gnc-module/test/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/CMakeLists.txt
@@ -34,16 +34,6 @@ ENDFUNCTION()
 
 GNC_ADD_TEST_WITH_GUILE(test-load-c test-load-c.c GNC_MODULE_TEST_INCLUDE_DIRS GNC_MODULE_TEST_LIBS "GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test")
 
-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
 )
@@ -64,31 +54,36 @@ GNC_ADD_TEST(test-dynload test-dynload.c
   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};GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test")
-  ENDIF()
-  ADD_TEST(NAME ${_TARGET}
-    COMMAND ${CMAKE_COMMAND_TMP}
-      ${SHELL} ${_SOURCE_FILE}
+SET(test_gnc_module_SCHEME
+  test-gnc-module-scm-init.scm
+  test-gnc-module-load-scm.scm
+  test-gnc-module-swigged-c.scm
+  test-gnc-module-load-deps.scm
+  test-gnc-module-scm-dynload.scm
+  test-gnc-module-scm-module.scm
+  test-gnc-module-scm-multi.scm
   )
-  SET_TESTS_PROPERTIES(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};GNC_MODULE_PATH=${CMAKE_BINARY_DIR}/lib/gnucash/test")
-ENDFUNCTION()
 
-RUN_GUILE_SHELL_TEST(test-gwrapped-c ${CMAKE_CURRENT_BINARY_DIR}/test-gwrapped-c)
+SET(GUILE_DEPENDS gnc-module scm-test-core scm-mod-foo scm-mod-baz)
 
-RUN_GUILE_SHELL_TEST(test-scm-module ${CMAKE_CURRENT_BINARY_DIR}/test-scm-module)
+GNC_ADD_SCHEME_TARGETS(test-gnc-modules-scm
+  "${test_gnc_module_SCHEME}"
+  "gnucash/gnc-modules/test"
+  "${GUILE_DEPENDS}"
+  TRUE
+  )
+
+GNC_ADD_SCHEME_TESTS("${test_gnc_module_SCHEME}")
+IF(NOT WIN32)
+  # This little dance is needed because gnc_module_init will assert if
+  # it finds libgncmod_futuremod.so outside of a test that expects it.
+  GET_GUILE_ENV()
+  SET(_GNC_MODULE_PATH "${CMAKE_BINARY_DIR}/lib:${CMAKE_BINARY_DIR}/lib/gnucash:${CMAKE_BINARY_DIR}/lib/gnucash/test")
+  FOREACH(test_file ${test_gnc_module_SCHEME})
+    GET_FILENAME_COMPONENT(basename ${test_file} NAME_WE)
+    SET_TESTS_PROPERTIES(${basename} PROPERTIES ENVIRONMENT "${GUILE_ENV};GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
+  ENDFOREACH()
+ENDIF()
 
 SET(test_gnc_module_SOURCE_DIST
   test-agedver.c
@@ -100,13 +95,7 @@ SET(test_gnc_module_SOURCE_DIST
 
 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
+  ${test_gnc_module_SCHEME}
 )
 
 SET_LOCAL_DIST(test_gnc_module_DIST_local CMakeLists.txt Makefile.am README ${test_gnc_module_SOURCE_DIST} ${test_gnc_module_EXTRA_DIST})
diff --git a/libgnucash/gnc-module/test/Makefile.am b/libgnucash/gnc-module/test/Makefile.am
index 13b0188..05d31c3 100644
--- a/libgnucash/gnc-module/test/Makefile.am
+++ b/libgnucash/gnc-module/test/Makefile.am
@@ -14,17 +14,22 @@ AM_CPPFLAGS = \
 
 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
+  ${SCM_TESTS}
+
+SCM_TESTS = \
+  test-gnc-module-load-scm \
+  test-gnc-module-swigged-c \
+  test-gnc-module-scm-module \
+  test-gnc-module-scm-multi \
+  test-gnc-module-load-deps \
+  test-gnc-module-scm-dynload \
+  test-gnc-module-scm-init
+
+SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
 
 GNC_TEST_DEPS = \
   --gnc-module-dir ${top_builddir}/libgnucash/gnc-module \
@@ -58,14 +63,14 @@ check_PROGRAMS = \
 
 test_dynload_LDFLAGS = ${GUILE_LIBS}
 
+$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
+	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 $@
+
 EXTRA_DIST = \
-  test-gwrapped-c \
-  test-load-deps \
-  test-load-scm \
-  test-scm-dynload \
-  test-scm-init \
-  test-scm-module \
-  test-scm-multi \
+  ${SCM_TEST_SRCS} \
   CMakeLists.txt
 
 foo:
diff --git a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
index 776150c..17c3c56 100644
--- a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
@@ -27,6 +27,13 @@ TARGET_INCLUDE_DIRECTORIES(gncmodbaz PRIVATE
   ${GUILE_INCLUDE_DIRS}
 )
 
+GNC_ADD_SCHEME_TARGETS(scm-mod-baz
+  gnucash/baz.scm
+  "gnucash"
+  gncmodbaz
+  TRUE
+  )
+
 SET_TARGET_PROPERTIES(baz gncmodbaz PROPERTIES
 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
 ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
diff --git a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
index 2b5d1ce..0a6d37f 100644
--- a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
@@ -21,6 +21,13 @@ TARGET_INCLUDE_DIRECTORIES(gncmodfoo PRIVATE
   ${GUILE_INCLUDE_DIRS}
 )
 
+GNC_ADD_SCHEME_TARGETS(scm-mod-foo
+  gnucash/foo.scm
+  "gnucash"
+  gncmodfoo
+  TRUE
+  )
+
 SET_TARGET_PROPERTIES(foo gncmodfoo PROPERTIES
 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
 ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gnucash/test
diff --git a/libgnucash/gnc-module/test/test-load-deps.in b/libgnucash/gnc-module/test/test-gnc-module-load-deps.scm
similarity index 81%
rename from libgnucash/gnc-module/test/test-load-deps.in
rename to libgnucash/gnc-module/test/test-gnc-module-load-deps.scm
index 9af6410..d88791f 100755
--- a/libgnucash/gnc-module/test/test-load-deps.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-load-deps.scm
@@ -1,8 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s $0 "$@"
-!#
-;; test-load-deps.scm : load gnc-mod-baz, which depends on gnc-mod-foo
-
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -25,7 +20,3 @@ exec ${GUILE} -s $0 "$@"
 (g-log-remove-handler log-domain handler)
 
 (exit 0)
-
-;; Local Variables:
-;; mode: scheme
-;; End:
diff --git a/libgnucash/gnc-module/test/test-load-scm.in b/libgnucash/gnc-module/test/test-gnc-module-load-scm.scm
similarity index 88%
copy from libgnucash/gnc-module/test/test-load-scm.in
copy to libgnucash/gnc-module/test/test-gnc-module-load-scm.scm
index 61eddeb..d67fb19 100755
--- a/libgnucash/gnc-module/test/test-load-scm.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-load-scm.scm
@@ -1,7 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s $0 "$@"
-!#
-
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -15,6 +11,4 @@ exec ${GUILE} -s $0 "$@"
 (gnc:module-system-init)
 (gnc:module-load "gnucash/foo" 0)
 (g-log-remove-handler log-domain handler)
-;; Local Variables:
-;; mode: scheme
-;; End:
+(exit 0)
diff --git a/libgnucash/gnc-module/test/test-gnc-module-scm-dynload.scm b/libgnucash/gnc-module/test/test-gnc-module-scm-dynload.scm
new file mode 100755
index 0000000..5a81132
--- /dev/null
+++ b/libgnucash/gnc-module/test/test-gnc-module-scm-dynload.scm
@@ -0,0 +1,5 @@
+(if (or (string=? (version) "1.3")
+        (string=? (version) "1.3.4"))
+    (dynamic-link "libgnc-module.so")
+    (dynamic-link "libgnc-module"))
+(exit 0)
diff --git a/libgnucash/gnc-module/test/test-scm-init.in b/libgnucash/gnc-module/test/test-gnc-module-scm-init.scm
similarity index 79%
rename from libgnucash/gnc-module/test/test-scm-init.in
rename to libgnucash/gnc-module/test/test-gnc-module-scm-init.scm
index 9825da7..c18f994 100755
--- a/libgnucash/gnc-module/test/test-scm-init.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-scm-init.scm
@@ -1,8 +1,3 @@
-#! @SHELL@
-echo "  test-scm-init: testing Scheme-only module system init. ";
-exec ${GUILE} -s $0 "$@"
-!#
-
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -17,7 +12,4 @@ exec ${GUILE} -s $0 "$@"
 (gnc:module-system-init)
 
 (g-log-remove-handler log-domain handler)
-
-;; LocalVariables:
-;; mode: scheme
-;; End:
+(exit 0)
diff --git a/libgnucash/gnc-module/test/test-load-scm.in b/libgnucash/gnc-module/test/test-gnc-module-scm-module.scm
similarity index 83%
copy from libgnucash/gnc-module/test/test-load-scm.in
copy to libgnucash/gnc-module/test/test-gnc-module-scm-module.scm
index 61eddeb..ccfd804 100755
--- a/libgnucash/gnc-module/test/test-load-scm.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-scm-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s $0 "$@"
-!#
-
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -13,8 +9,6 @@ exec ${GUILE} -s $0 "$@"
 (define handler (test-set-checked-handler log-domain log-level check))
 (use-modules (gnucash gnc-module))
 (gnc:module-system-init)
-(gnc:module-load "gnucash/foo" 0)
+(if (not (gnc:module-load "gnucash/foo" 0)) (exit -1))
+(exit (foo:scheme-hello))
 (g-log-remove-handler log-domain handler)
-;; Local Variables:
-;; mode: scheme
-;; End:
diff --git a/libgnucash/gnc-module/test/test-scm-multi.in b/libgnucash/gnc-module/test/test-gnc-module-scm-multi.scm
similarity index 86%
rename from libgnucash/gnc-module/test/test-scm-multi.in
rename to libgnucash/gnc-module/test/test-gnc-module-scm-multi.scm
index c0600a2..bc938f2 100755
--- a/libgnucash/gnc-module/test/test-scm-multi.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-scm-multi.scm
@@ -1,6 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s $0 "$@"
-!#
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -12,7 +9,7 @@ exec ${GUILE} -s $0 "$@"
 (define handler (test-set-checked-handler log-domain log-level check))
 
 (use-modules (gnucash gnc-module))
-(gnc:module-system-init) 
+(gnc:module-system-init)
 (gnc:module-load "gnucash/foo" 0)
 (foo-hello)
 (foo:scheme-hello)
@@ -23,7 +20,4 @@ exec ${GUILE} -s $0 "$@"
 (bar:scheme-hello)
 
 (g-log-remove-handler log-domain handler)
-
-;; Local Variables:
-;; mode: scheme
-;; End:
+(exit 0)
diff --git a/libgnucash/gnc-module/test/test-load-scm.in b/libgnucash/gnc-module/test/test-gnc-module-swigged-c.scm
similarity index 88%
rename from libgnucash/gnc-module/test/test-load-scm.in
rename to libgnucash/gnc-module/test/test-gnc-module-swigged-c.scm
index 61eddeb..913b49f 100755
--- a/libgnucash/gnc-module/test/test-load-scm.in
+++ b/libgnucash/gnc-module/test/test-gnc-module-swigged-c.scm
@@ -1,7 +1,3 @@
-#! @SHELL@
-exec ${GUILE} -s $0 "$@"
-!#
-
 (use-modules (gnucash unittest-support))
 (define log-domain "gnc.module")
 (define check (new-TestErrorStruct))
@@ -14,7 +10,5 @@ exec ${GUILE} -s $0 "$@"
 (use-modules (gnucash gnc-module))
 (gnc:module-system-init)
 (gnc:module-load "gnucash/foo" 0)
+(exit (eq? 10 (foo-hello)))
 (g-log-remove-handler log-domain handler)
-;; Local Variables:
-;; mode: scheme
-;; End:
diff --git a/libgnucash/gnc-module/test/test-gwrapped-c.in b/libgnucash/gnc-module/test/test-gwrapped-c.in
deleted file mode 100755
index b3dacaf..0000000
--- a/libgnucash/gnc-module/test/test-gwrapped-c.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#! @SHELL@
-${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 '../../../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)
-          (define handler (test-set-checked-handler log-domain log-level check))
-          (use-modules (gnucash gnc-module))
-          (gnc:module-system-init)
-          (gnc:module-load \"gnucash/foo\" 0)
-          (exit (eq? 10 (foo-hello)))
-          (g-log-remove-handler log-domain handler)"
diff --git a/libgnucash/gnc-module/test/test-scm-dynload.in b/libgnucash/gnc-module/test/test-scm-dynload.in
deleted file mode 100755
index b5d6a41..0000000
--- a/libgnucash/gnc-module/test/test-scm-dynload.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#! @SHELL@
-echo "  test-scm-dynload: testing dynamic-link of libgnc-module from Scheme.";
-exec ${GUILE} -s $0 "$@"
-!#
-
-(if (or (string=? (version) "1.3")
-        (string=? (version) "1.3.4"))
-    (dynamic-link "libgnc-module.so")
-    (dynamic-link "libgnc-module"))
-
-;; LocalVariables:
-;; mode: scheme
-;; End:
-
-
diff --git a/libgnucash/gnc-module/test/test-scm-module.in b/libgnucash/gnc-module/test/test-scm-module.in
deleted file mode 100755
index efac218..0000000
--- a/libgnucash/gnc-module/test/test-scm-module.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#! @SHELL@
-${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 '../../../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)
-          (define handler (test-set-checked-handler log-domain log-level check))
-          (use-modules (gnucash gnc-module))
-          (gnc:module-system-init)
-          (if (not (gnc:module-load \"gnucash/foo\" 0)) (exit -1))
-          (exit (foo:scheme-hello))
-          (g-log-remove-handler log-domain handler)"
diff --git a/libgnucash/tax/us/test/CMakeLists.txt b/libgnucash/tax/us/test/CMakeLists.txt
index df3d867..acb8a5d 100644
--- a/libgnucash/tax/us/test/CMakeLists.txt
+++ b/libgnucash/tax/us/test/CMakeLists.txt
@@ -6,6 +6,17 @@ GNC_ADD_TEST(test-link-module-tax-us test-link-module.c
 )
 
 # This test not run in autotools build.
-#GNC_ADD_SCHEME_TEST(test-load-module-tax-us test-load-module.in)
+#SET(GUILE_DEPENDS
+#  gnc-core-utils
+#  gnc-module
+#)
+#
+#GNC_ADD_SCHEME_TARGETS(scm-test-load-tax-us-module
+#  "test-load-tax-us-module.scm"
+#  "gnucash/reports"
+#  "${GUILE_DEPENDS}"
+#  FALSE
+#)
+#GNC_ADD_SCHEME_TEST(test-load-tax-us-module.scm)
 
-SET_DIST_LIST(test_tax_us_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-module.in)
\ No newline at end of file
+SET_DIST_LIST(test_tax_us_DIST CMakeLists.txt Makefile.am test-link-module.c test-load-tax-us-module.scm)
diff --git a/libgnucash/tax/us/test/test-load-module.in b/libgnucash/tax/us/test/test-load-tax-us-module.scm
similarity index 87%
rename from libgnucash/tax/us/test/test-load-module.in
rename to libgnucash/tax/us/test/test-load-tax-us-module.scm
index 86a8799..ee2be93 100755
--- a/libgnucash/tax/us/test/test-load-module.in
+++ b/libgnucash/tax/us/test/test-load-tax-us-module.scm
@@ -1,7 +1,3 @@
-#! @SHELL@ 
-exec ${GUILE} -s "$0"
-!#
-
 (display "  testing US tax info module load ... ")
 (use-modules (gnucash gnc-module))
 (gnc:module-system-init)
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 45f38fc..0051314 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -13,6 +13,7 @@ gnucash/gnome-utils/gnc-tree-model-selection.c
 
 libgnucash/app-utils/gnucash/app-utils.scm
 libgnucash/app-utils/gnucash/gettext.scm
+libgnucash/app-utils/test/test-load-app-utils-module.scm
 libgnucash/core-utils/gnucash/core-utils.scm
 libgnucash/engine/gnucash/business-core.scm
 libgnucash/engine/gnucash/engine.scm

commit f412795ef21d5982758bceea53161a57127a32ab
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Nov 2 14:46:05 2017 -0700

    Remove extraneous parameters from GNC_ADD_SCHEME_TARGETS

diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
index 2d2478d..3ad98bc 100644
--- a/common/cmake_modules/GncAddSchemeTargets.cmake
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -26,17 +26,12 @@ FUNCTION(MAKE_UNIX_PATH_LIST 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
+FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _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)
@@ -92,9 +87,6 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR
     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}")
@@ -149,7 +141,6 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR
       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)
diff --git a/common/test-core/CMakeLists.txt b/common/test-core/CMakeLists.txt
index 70ccece..9d2e335 100644
--- a/common/test-core/CMakeLists.txt
+++ b/common/test-core/CMakeLists.txt
@@ -52,18 +52,12 @@ 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
   )
diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
index 4588de8..084ecb2 100644
--- a/gnucash/gnome-utils/CMakeLists.txt
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -246,17 +246,11 @@ 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
 )
@@ -265,9 +259,6 @@ GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-1
 GNC_ADD_SCHEME_TARGETS(scm-gnome-utils-2
   gnc-menu-extensions.scm
   ""
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
   "${GUILE_DEPENDS}"
   FALSE
 )
diff --git a/gnucash/import-export/qif-imp/CMakeLists.txt b/gnucash/import-export/qif-imp/CMakeLists.txt
index 8334451..9c7e0e3 100644
--- a/gnucash/import-export/qif-imp/CMakeLists.txt
+++ b/gnucash/import-export/qif-imp/CMakeLists.txt
@@ -54,17 +54,11 @@ 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
 )
@@ -72,9 +66,6 @@ GNC_ADD_SCHEME_TARGETS(scm-qif-import-2
 GNC_ADD_SCHEME_TARGETS(scm-qif-import
   "${qif_import_SCHEME}"
   "qif-import"
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
   "${GUILE_DEPENDS}"
   FALSE
 )
diff --git a/gnucash/report/business-reports/CMakeLists.txt b/gnucash/report/business-reports/CMakeLists.txt
index 224ba51..c55e626 100644
--- a/gnucash/report/business-reports/CMakeLists.txt
+++ b/gnucash/report/business-reports/CMakeLists.txt
@@ -25,20 +25,11 @@ SET(business_reports_DATA
 )
 
 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_OUTPUT_DIR}
   "${GUILE_DEPENDS}"
   TRUE
 )
diff --git a/gnucash/report/locale-specific/us/CMakeLists.txt b/gnucash/report/locale-specific/us/CMakeLists.txt
index 6793bb5..97f7211 100644
--- a/gnucash/report/locale-specific/us/CMakeLists.txt
+++ b/gnucash/report/locale-specific/us/CMakeLists.txt
@@ -30,19 +30,11 @@ 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
 )
@@ -50,9 +42,6 @@ GNC_ADD_SCHEME_TARGETS(scm-report-locale-specific-1
 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
 )
diff --git a/gnucash/report/report-gnome/CMakeLists.txt b/gnucash/report/report-gnome/CMakeLists.txt
index ab4bc9a..e2362e2 100644
--- a/gnucash/report/report-gnome/CMakeLists.txt
+++ b/gnucash/report/report-gnome/CMakeLists.txt
@@ -54,17 +54,11 @@ SET(report_gnome_SCHEME
 )
 
 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
 )
diff --git a/gnucash/report/report-system/CMakeLists.txt b/gnucash/report/report-system/CMakeLists.txt
index 6f0bbef..a589284 100644
--- a/gnucash/report/report-system/CMakeLists.txt
+++ b/gnucash/report/report-system/CMakeLists.txt
@@ -78,19 +78,11 @@ SET (report_system_SCHEME_3
     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
 )
@@ -98,9 +90,6 @@ GNC_ADD_SCHEME_TARGETS(scm-report-system
 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
 )
@@ -108,9 +97,6 @@ GNC_ADD_SCHEME_TARGETS(scm-report-system-2
 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
 )
diff --git a/gnucash/report/report-system/test/CMakeLists.txt b/gnucash/report/report-system/test/CMakeLists.txt
index 897517a..fc03bc7 100644
--- a/gnucash/report/report-system/test/CMakeLists.txt
+++ b/gnucash/report/report-system/test/CMakeLists.txt
@@ -22,9 +22,6 @@ GNC_ADD_SCHEME_TEST(test-load-module-report-system test-load-module.in)
 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
   )
@@ -32,9 +29,6 @@ GNC_ADD_SCHEME_TARGETS(scm-test-report-system
 GNC_ADD_SCHEME_TARGETS(scm-test-report-system-2
   "${scm_test_report_system_SOURCES}"
   gnucash/report/report-system/test
-  ""
-  ""
-  ""
   "scm-test-report-system"
   FALSE
 )
diff --git a/gnucash/report/standard-reports/CMakeLists.txt b/gnucash/report/standard-reports/CMakeLists.txt
index 2ff9016..fa7be34 100644
--- a/gnucash/report/standard-reports/CMakeLists.txt
+++ b/gnucash/report/standard-reports/CMakeLists.txt
@@ -33,17 +33,11 @@ SET (standard_reports_SCHEME_2
     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
 )
@@ -51,9 +45,6 @@ GNC_ADD_SCHEME_TARGETS(scm-standard-reports-1
 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
 )
diff --git a/gnucash/report/standard-reports/test/CMakeLists.txt b/gnucash/report/standard-reports/test/CMakeLists.txt
index 6233372..6840203 100644
--- a/gnucash/report/standard-reports/test/CMakeLists.txt
+++ b/gnucash/report/standard-reports/test/CMakeLists.txt
@@ -11,9 +11,6 @@ GNC_ADD_SCHEME_TESTS(${scm_test_standard_reports_SOURCES})
 GNC_ADD_SCHEME_TARGETS(scm-test-standard-reports
   "${scm_test_standard_reports_SOURCES}"
   gnucash/report/standard-reports/test
-  ""
-  ""
-  ""
   "scm-gnc-module;scm-test-report-system;scm-standard-reports;scm-report-stylesheets-2"
   FALSE
 )
diff --git a/gnucash/report/stylesheets/CMakeLists.txt b/gnucash/report/stylesheets/CMakeLists.txt
index 0964272..8ca7325 100644
--- a/gnucash/report/stylesheets/CMakeLists.txt
+++ b/gnucash/report/stylesheets/CMakeLists.txt
@@ -48,17 +48,11 @@ SET(stylesheets_SCHEME_2
 )
 
 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
 )
@@ -66,9 +60,6 @@ GNC_ADD_SCHEME_TARGETS(scm-report-stylesheets-1
 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
 )
diff --git a/gnucash/report/utility-reports/CMakeLists.txt b/gnucash/report/utility-reports/CMakeLists.txt
index c3221a7..64ffc1e 100644
--- a/gnucash/report/utility-reports/CMakeLists.txt
+++ b/gnucash/report/utility-reports/CMakeLists.txt
@@ -8,19 +8,11 @@ SET(utility_reports_SCHEME
 )
 
 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
 )
diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
index 3b2a312..db1507c 100644
--- a/libgnucash/app-utils/CMakeLists.txt
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -175,17 +175,11 @@ 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
 )
@@ -193,9 +187,6 @@ GNC_ADD_SCHEME_TARGETS(scm-gettext
 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
 )
@@ -203,9 +194,6 @@ GNC_ADD_SCHEME_TARGETS(scm-app-utils-1
 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
 )
@@ -213,9 +201,6 @@ GNC_ADD_SCHEME_TARGETS(scm-app-utils-2
 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
 )
diff --git a/libgnucash/core-utils/CMakeLists.txt b/libgnucash/core-utils/CMakeLists.txt
index d667b9e..dd4ff00 100644
--- a/libgnucash/core-utils/CMakeLists.txt
+++ b/libgnucash/core-utils/CMakeLists.txt
@@ -198,17 +198,11 @@ ENDIF()
 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/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt
index 1b2f626..b7f4fb0 100644
--- a/libgnucash/engine/CMakeLists.txt
+++ b/libgnucash/engine/CMakeLists.txt
@@ -288,18 +288,12 @@ 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
 )
@@ -307,9 +301,6 @@ GNC_ADD_SCHEME_TARGETS(scm-engine-0
 GNC_ADD_SCHEME_TARGETS(scm-engine-1
   "${engine_SCHEME_1}"
   ""
-  ""
-  ""
-  ""
   "scm-engine-0;${GUILE_DEPENDS}"
   FALSE
 )
diff --git a/libgnucash/engine/test/CMakeLists.txt b/libgnucash/engine/test/CMakeLists.txt
index bd6bd45..10a6d62 100644
--- a/libgnucash/engine/test/CMakeLists.txt
+++ b/libgnucash/engine/test/CMakeLists.txt
@@ -219,17 +219,11 @@ GNC_ADD_SCHEME_TEST(scm-test-split test-split.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
 )
diff --git a/libgnucash/gnc-module/CMakeLists.txt b/libgnucash/gnc-module/CMakeLists.txt
index 4e441c9..250fd55 100644
--- a/libgnucash/gnc-module/CMakeLists.txt
+++ b/libgnucash/gnc-module/CMakeLists.txt
@@ -50,17 +50,11 @@ INSTALL(FILES ${gnc_module_HEADERS} DESTINATION include/gnucash)
 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
 )
diff --git a/libgnucash/scm/CMakeLists.txt b/libgnucash/scm/CMakeLists.txt
index 72f0d78..4d0aa5b 100644
--- a/libgnucash/scm/CMakeLists.txt
+++ b/libgnucash/scm/CMakeLists.txt
@@ -22,9 +22,6 @@ 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
@@ -35,16 +32,13 @@ SET(scm_SCHEME_0
   xml-generator.scm
 )
 
-GNC_ADD_SCHEME_TARGETS(scm-scm-0 "${scm_SCHEME_0}" "" "" "" "" "" FALSE)
+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-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
 )
@@ -53,9 +47,6 @@ GNC_ADD_SCHEME_TARGETS(scm-scm-2
 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)
 
diff --git a/libgnucash/scm/gnumeric/CMakeLists.txt b/libgnucash/scm/gnumeric/CMakeLists.txt
index e262e9d..549761a 100644
--- a/libgnucash/scm/gnumeric/CMakeLists.txt
+++ b/libgnucash/scm/gnumeric/CMakeLists.txt
@@ -3,18 +3,10 @@
 SET(gnumeric_SCHEME gnumeric-utilities.scm table-utils.scm)
 
 
-SET(GUILE_MODULES      "")
-SET(GUILE_LOAD_DIRS    "")
-SET(GUILE_LIBRARY_DIRS "")
-SET(GUILE_DEPENDS      "")
-
 GNC_ADD_SCHEME_TARGETS(scm-gnumeric
   "${gnumeric_SCHEME}"
   gnumeric
-  "${GUILE_MODULES}"
-  "${GUILE_LOAD_DIRS}"
-  "${GUILE_LIBRARY_DIRS}"
-  "${GUILE_DEPENDS}"
+  ""
   FALSE
 )
 
diff --git a/libgnucash/tax/us/CMakeLists.txt b/libgnucash/tax/us/CMakeLists.txt
index c99f1b8..83479bd 100644
--- a/libgnucash/tax/us/CMakeLists.txt
+++ b/libgnucash/tax/us/CMakeLists.txt
@@ -26,26 +26,17 @@ INSTALL(TARGETS gncmod-tax-us
 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
   )

commit 3b0bcf75e89505bc5ed96b05617f73fee22b2dd0
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Thu Nov 2 09:13:34 2017 -0600

    report: fix negative colors in barcharts
    
    Specified bar colors only apply to positive bars in the plot.
    Negative bars still have the default colors, which are slightly
    darker shades of the default positive colors.
    
    This commit forces negative bars to have the same colors as
    positive bars.

diff --git a/gnucash/report/report-system/html-barchart.scm b/gnucash/report/report-system/html-barchart.scm
index f172fa1..76c18a2 100644
--- a/gnucash/report/report-system/html-barchart.scm
+++ b/gnucash/report/report-system/html-barchart.scm
@@ -514,6 +514,9 @@
                   (push "options.seriesColors = [")
                   (push colors-str)
                   (push "];\n")
+                  (push "options.negativeSeriesColors = [")
+                  (push colors-str)
+                  (push "];\n")
                   )
                 )
 

commit ed3de42c96d4cc0032eb624dc356de05acaa93d0
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:30:03 2017 +0000

    Update the register for the change in RegisterColor enums
    
    Change the map of RegisterColors to CSS style classes to reflect the
    changes and reduce the get colour type to one call per class

diff --git a/gnucash/register/register-gnome/gnucash-header.c b/gnucash/register/register-gnome/gnucash-header.c
index f279971..156ae68 100644
--- a/gnucash/register/register-gnome/gnucash-header.c
+++ b/gnucash/register/register-gnome/gnucash-header.c
@@ -88,8 +88,8 @@ gnc_header_draw_offscreen (GncHeader *header)
 
     gtk_style_context_save (stylectxt);
 
-    // Get the background color type and apply the css class
-    color_type = gnc_table_get_bg_color (table, virt_loc, NULL);
+    // Get the color type and apply the css class
+    color_type = gnc_table_get_color (table, virt_loc, NULL);
     gnucash_get_style_classes (header->sheet, stylectxt, color_type);
 
     if (header->surface)
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index acbc323..39641d1 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -487,11 +487,8 @@ draw_background_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 
     gtk_style_context_save (stylectxt);
 
-    // Get the background and foreground color types and apply the css class
-    color_type = gnc_table_get_bg_color (item_edit->sheet->table, item_edit->virt_loc, NULL);
-    gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
-
-    color_type = gnc_table_get_fg_color (item_edit->sheet->table, item_edit->virt_loc);
+    // Get the color type and apply the css class
+    color_type = gnc_table_get_color (item_edit->sheet->table, item_edit->virt_loc, NULL);
     gnucash_get_style_classes (item_edit->sheet, stylectxt, color_type);
 
     gtk_render_background (stylectxt, cr, 0, 1, width, height - 2);
diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c
index 7631caa..e71db31 100644
--- a/gnucash/register/register-gnome/gnucash-sheet-private.c
+++ b/gnucash/register/register-gnome/gnucash-sheet-private.c
@@ -399,11 +399,8 @@ draw_cell (GnucashSheet *sheet,
 
     gtk_style_context_save (stylectxt);
 
-    // Get the background and foreground color types and apply the css class
-    color_type = gnc_table_get_bg_color (table, virt_loc, &hatching);
-    gnucash_get_style_classes (sheet, stylectxt, color_type);
-
-    color_type = gnc_table_get_fg_color (table, virt_loc);
+    // Get the color type and apply the css class
+    color_type = gnc_table_get_color (table, virt_loc, &hatching);
     gnucash_get_style_classes (sheet, stylectxt, color_type);
 
     // Are we in a read-only row? Then make the background color somewhat more grey.
diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 5a66605..311ab1b 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -2428,52 +2428,46 @@ gnucash_sheet_table_load (GnucashSheet *sheet, gboolean do_scroll)
 
 /*************************************************************/
 
-/** Map a cell type to a css style class. */
+/** Map a cell color type to a css style class. */
 void
 gnucash_get_style_classes (GnucashSheet *sheet, GtkStyleContext *stylectxt,
                            RegisterColor field_type)
 {
     gchar *full_class, *style_class = NULL;
 
+    if (field_type >= COLOR_NEGATIVE) // Require a Negative fg color
+    {
+        gtk_style_context_add_class (stylectxt, "negative-numbers");
+        field_type -= COLOR_NEGATIVE;
+    }
+
     switch (field_type)
     {
     default:
-    case COLOR_UNKNOWN_BG:
-    case COLOR_UNKNOWN_FG:
+    case COLOR_UNDEFINED:
         gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND);
         return;
 
-    case COLOR_NEGATIVE:
-        gtk_style_context_add_class (stylectxt, "negative-numbers");
-        return;
-
-    case COLOR_HEADER_BG:
-    case COLOR_HEADER_FG:
+    case COLOR_HEADER:
         style_class = "header";
         break;
 
-    case COLOR_PRIMARY_BG:
-    case COLOR_PRIMARY_FG:
+    case COLOR_PRIMARY:
         style_class = "primary";
         break;
 
-    case COLOR_PRIMARY_BG_ACTIVE:
-    case COLOR_PRIMARY_FG_ACTIVE:
-    case COLOR_SECONDARY_BG_ACTIVE:
-    case COLOR_SECONDARY_FG_ACTIVE:
-    case COLOR_SPLIT_BG_ACTIVE:
-    case COLOR_SPLIT_FG_ACTIVE:
+    case COLOR_PRIMARY_ACTIVE:
+    case COLOR_SECONDARY_ACTIVE:
+    case COLOR_SPLIT_ACTIVE:
         gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_SELECTED);
         style_class = "cursor";
         break;
 
-    case COLOR_SECONDARY_BG:
-    case COLOR_SECONDARY_FG:
+    case COLOR_SECONDARY:
         style_class = "secondary";
         break;
 
-    case COLOR_SPLIT_BG:
-    case COLOR_SPLIT_FG:
+    case COLOR_SPLIT:
         style_class = "split";
         break;
     }

commit 6228881d6a23753ada928eb27fdd2a43963a3fbc
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:25:55 2017 +0000

    Change the split and entry models to reflect the colour changes

diff --git a/gnucash/register/ledger-core/gncEntryLedgerModel.c b/gnucash/register/ledger-core/gncEntryLedgerModel.c
index 8c5207d..a638d06 100644
--- a/gnucash/register/ledger-core/gncEntryLedgerModel.c
+++ b/gnucash/register/ledger-core/gncEntryLedgerModel.c
@@ -915,65 +915,57 @@ static CellIOFlags get_qty_io_flags (VirtualLocation virt_loc, gpointer user_dat
     return flags;
 }
 
-/* GET BG_COLORS */
+/* GET COLORS */
 
 static guint32
-gnc_entry_ledger_get_color_internal (VirtualLocation virt_loc,
-                                     GncEntryLedger *ledger,
-                                     gboolean foreground)
+gnc_entry_ledger_get_cell_color_internal (VirtualLocation virt_loc,
+                                          GncEntryLedger *ledger)
 {
     VirtualCell *vcell;
     gboolean is_current;
-    guint32 colorbase = 0; /* By default return background colors */
+    guint32 colorbase = 0;
 
-    if (foreground)
-        colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
+    /* a bit of enum arithmetic */
+
+    // There are negative numbers
 
     if (!ledger)
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     if (gnc_table_virtual_location_in_header (ledger->table, virt_loc))
-        return (colorbase + COLOR_HEADER_BG);
+        return (colorbase + COLOR_HEADER);
 
     vcell = gnc_table_get_virtual_cell (ledger->table, virt_loc.vcell_loc);
     if (!vcell || !vcell->cellblock)
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
             (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     is_current = virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
                                       virt_loc.vcell_loc);
 
     if (is_current)
         return vcell->start_primary_color ?
-                (colorbase + COLOR_PRIMARY_BG_ACTIVE) :
-                (colorbase + COLOR_SECONDARY_BG_ACTIVE);
+                (colorbase + COLOR_PRIMARY_ACTIVE) :
+                (colorbase + COLOR_SECONDARY_ACTIVE);
 
     return vcell->start_primary_color ?
-            (colorbase + COLOR_PRIMARY_BG) : (colorbase + COLOR_SECONDARY_BG);
+            (colorbase + COLOR_PRIMARY) : (colorbase + COLOR_SECONDARY);
 
 }
 
 static guint32
-gnc_entry_ledger_get_fg_color (VirtualLocation virt_loc,
-                               gpointer user_data)
-{
-    GncEntryLedger *ledger = user_data;
-    return gnc_entry_ledger_get_color_internal (virt_loc, ledger, TRUE);
-}
-
-static guint32
-gnc_entry_ledger_get_bg_color (VirtualLocation virt_loc,
-                               gboolean *hatching, gpointer user_data)
+gnc_entry_ledger_get_cell_color (VirtualLocation virt_loc,
+                                 gboolean *hatching, gpointer user_data)
 {
     GncEntryLedger *ledger = user_data;
 
     if (hatching)
         *hatching = FALSE;
 
-    return gnc_entry_ledger_get_color_internal (virt_loc, ledger, FALSE);
+    return gnc_entry_ledger_get_cell_color_internal (virt_loc, ledger);
 }
 
 /* SAVE CELLS */
@@ -1225,11 +1217,8 @@ static void gnc_entry_ledger_model_new_handlers (TableModel *model,
     };
     unsigned int i;
 
-    gnc_table_model_set_default_fg_color_handler
-    (model, gnc_entry_ledger_get_fg_color);
-
-    gnc_table_model_set_default_bg_color_handler
-    (model, gnc_entry_ledger_get_bg_color);
+    // Set the cell color handler
+    gnc_table_model_set_default_cell_color_handler (model, gnc_entry_ledger_get_cell_color);
 
     for (i = 0; i < (sizeof(models) / sizeof(*models)); i++)
     {
diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c
index 3a2fac4..f8b6614 100644
--- a/gnucash/register/ledger-core/split-register-model.c
+++ b/gnucash/register/ledger-core/split-register-model.c
@@ -514,33 +514,85 @@ get_trans_total_balance (SplitRegister *reg, Transaction *trans)
     return xaccTransGetAccountBalance(trans, account);
 }
 
+static gboolean
+gnc_split_register_use_negative_color (VirtualLocation virt_loc,
+                                       SplitRegister *reg)
+{
+    const char * cell_name;
+    gnc_numeric value;
+    Split *split;
+
+    if (!use_red_for_negative)
+        return FALSE;
+
+    split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
+    if (!split)
+        return FALSE;
+
+    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 TRUE;
+
+    return FALSE;
+}
+
 static guint32
-gnc_split_register_get_color_internal (VirtualLocation virt_loc,
-                                       SplitRegister *reg,
-                                       gboolean foreground)
+gnc_split_register_get_cell_color_internal (VirtualLocation virt_loc,
+                                            SplitRegister *reg)
 {
     const char *cursor_name;
     VirtualCell *vcell;
     gboolean is_current;
     gboolean double_alternate_virt;
-    guint32 colorbase = 0; /* By default return background colors */
+    guint32 colorbase = 0;
 
-    if (foreground)
-        colorbase = COLOR_UNKNOWN_FG; /* a bit of enum arithmetic */
+     /* a bit of enum arithmetic */
+
+    if (gnc_split_register_use_negative_color (virt_loc, reg))
+        colorbase = COLOR_NEGATIVE; // Requires Negative fg color
 
     if (!reg)
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     if (gnc_table_virtual_location_in_header (reg->table, virt_loc))
-        return (colorbase + COLOR_HEADER_BG);
+        return (colorbase + COLOR_HEADER);
 
     vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
     if (!vcell || !vcell->cellblock)
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
             (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
-        return (colorbase + COLOR_UNKNOWN_BG);
+        return (colorbase + COLOR_UNDEFINED);
 
     is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
                                       virt_loc.vcell_loc);
@@ -552,11 +604,11 @@ gnc_split_register_get_color_internal (VirtualLocation virt_loc,
     {
         if (is_current)
             return vcell->start_primary_color ?
-                    (colorbase + COLOR_PRIMARY_BG_ACTIVE) :
-                    (colorbase + COLOR_SECONDARY_BG_ACTIVE);
+                    (colorbase + COLOR_PRIMARY_ACTIVE) :
+                    (colorbase + COLOR_SECONDARY_ACTIVE);
 
         return vcell->start_primary_color ?
-                (colorbase + COLOR_PRIMARY_BG) : (colorbase + COLOR_SECONDARY_BG);
+                (colorbase + COLOR_PRIMARY) : (colorbase + COLOR_SECONDARY);
     }
 
     if (g_strcmp0 (cursor_name, CURSOR_DOUBLE_JOURNAL) == 0 ||
@@ -570,101 +622,40 @@ gnc_split_register_get_color_internal (VirtualLocation virt_loc,
         {
             if (double_alternate_virt)
                 return vcell->start_primary_color ?
-                        (colorbase + COLOR_PRIMARY_BG_ACTIVE) :
-                        (colorbase + COLOR_SECONDARY_BG_ACTIVE);
+                        (colorbase + COLOR_PRIMARY_ACTIVE) :
+                        (colorbase + COLOR_SECONDARY_ACTIVE);
 
             return (virt_loc.phys_row_offset % 2 == 0) ?
-                    (colorbase + COLOR_PRIMARY_BG_ACTIVE) :
-                    (colorbase + COLOR_SECONDARY_BG_ACTIVE);
+                    (colorbase + COLOR_PRIMARY_ACTIVE) :
+                    (colorbase + COLOR_SECONDARY_ACTIVE);
         }
 
         if (double_alternate_virt)
             return vcell->start_primary_color ?
-                    (colorbase + COLOR_PRIMARY_BG) :
-                    (colorbase + COLOR_SECONDARY_BG);
+                    (colorbase + COLOR_PRIMARY) :
+                    (colorbase + COLOR_SECONDARY);
 
         return (virt_loc.phys_row_offset % 2 == 0) ?
-                (colorbase + COLOR_PRIMARY_BG) :
-                (colorbase + COLOR_SECONDARY_BG);
+                (colorbase + COLOR_PRIMARY) :
+                (colorbase + COLOR_SECONDARY);
     }
 
     if (g_strcmp0 (cursor_name, CURSOR_SPLIT) == 0)
     {
         if (is_current)
-            return (colorbase + COLOR_SPLIT_BG_ACTIVE);
+            return (colorbase + COLOR_SPLIT_ACTIVE);
 
-        return (colorbase + COLOR_SPLIT_BG);
+        return (colorbase + COLOR_SPLIT);
     }
 
     PWARN ("Unexpected cursor: %s\n", cursor_name);
 
-    return (colorbase + COLOR_UNKNOWN_BG);
+    return (colorbase + COLOR_UNDEFINED);
 }
 
+// Get Color for non numeric cells, no hatching required
 static guint32
-gnc_split_register_get_fg_color_internal (VirtualLocation virt_loc,
-                                          SplitRegister *reg)
-{
-    guint32 fg_color;
-    const char * cell_name;
-    gnc_numeric value;
-    Split *split;
-
-    fg_color = gnc_split_register_get_color_internal (virt_loc, reg, 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 COLOR_NEGATIVE;
-
-    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);
-}
-
-static guint32
-gnc_split_register_get_bg_color (VirtualLocation virt_loc,
+gnc_split_register_get_cell_color (VirtualLocation virt_loc,
         gboolean *hatching,
         gpointer user_data)
 {
@@ -673,11 +664,12 @@ gnc_split_register_get_bg_color (VirtualLocation virt_loc,
     if (hatching)
         *hatching = FALSE;
 
-    return gnc_split_register_get_color_internal (virt_loc, reg, FALSE);
+    return gnc_split_register_get_cell_color_internal (virt_loc, reg);
 }
 
+// Get Color for numeric cells, update hatching
 static guint32
-gnc_split_register_get_debcred_bg_color (VirtualLocation virt_loc,
+gnc_split_register_get_debcred_color (VirtualLocation virt_loc,
         gboolean *hatching,
         gpointer user_data)
 {
@@ -694,8 +686,7 @@ gnc_split_register_get_debcred_bg_color (VirtualLocation virt_loc,
         else
             *hatching = FALSE;
     }
-
-    return gnc_split_register_get_bg_color (virt_loc, NULL, user_data);
+    return gnc_split_register_get_cell_color_internal (virt_loc, reg);
 }
 
 static void
@@ -2623,42 +2614,26 @@ gnc_split_register_model_new (void)
         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_default_bg_color_handler(
-        model, gnc_split_register_get_bg_color);
+    gnc_table_model_set_default_cell_color_handler(
+        model, gnc_split_register_get_cell_color);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, DEBT_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, DEBT_CELL);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, CRED_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, CRED_CELL);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, TDEBT_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, TDEBT_CELL);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, TCRED_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, TCRED_CELL);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, FCRED_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, FCRED_CELL);
 
-    gnc_table_model_set_bg_color_handler(
-        model, gnc_split_register_get_debcred_bg_color, FDEBT_CELL);
+    gnc_table_model_set_cell_color_handler(
+        model, gnc_split_register_get_debcred_color, FDEBT_CELL);
 
 
     gnc_table_model_set_default_cell_border_handler(

commit 98d8696b1a223c792dcd029149127c6a17d4e4c6
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:23:17 2017 +0000

    Reduce the RegisterColor enums so there is one for each type
    
    Combine the foreground and background colour enums so there are only
    eight and change the access function to gnc_table_get_color

diff --git a/gnucash/register/register-core/table-allgui.c b/gnucash/register/register-core/table-allgui.c
index 7e407db..038d3b0 100644
--- a/gnucash/register/register-core/table-allgui.c
+++ b/gnucash/register/register-core/table-allgui.c
@@ -345,68 +345,29 @@ gnc_table_get_label (Table *table, VirtualLocation virt_loc)
     return label;
 }
 
-static guint32
-gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc)
-{
-    TableGetFGColorHandler fg_color_handler;
-    const char *handler_name;
-
-    if (!table || !table->model)
-        return COLOR_UNKNOWN_FG;
-
-    handler_name = gnc_table_get_cell_name (table, virt_loc);
-
-    fg_color_handler = gnc_table_model_get_fg_color_handler (table->model,
-                       handler_name);
-    if (!fg_color_handler)
-    {
-        TableGetBGColorHandler bg_color_handler =
-            gnc_table_model_get_bg_color_handler (table->model, handler_name);
-
-        guint32 bg_color =
-            bg_color_handler (virt_loc, NULL, table->model->handler_user_data);
-        return bg_color + COLOR_UNKNOWN_FG;
-    }
-
-    return fg_color_handler (virt_loc, table->model->handler_user_data);
-}
-
 guint32
-gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
-{
-    return gnc_table_get_fg_color_internal (table, virt_loc);
-}
-
-static guint32
-gnc_table_get_bg_color_internal (Table *table, VirtualLocation virt_loc,
+gnc_table_get_color (Table *table, VirtualLocation virt_loc,
                                  gboolean *hatching)
 {
-    TableGetBGColorHandler bg_color_handler;
+    TableGetCellColorHandler color_handler;
     const char *handler_name;
 
     if (hatching)
         *hatching = FALSE;
 
     if (!table || !table->model)
-        return COLOR_UNKNOWN_BG;
+        return COLOR_UNDEFINED;
 
     handler_name = gnc_table_get_cell_name (table, virt_loc);
 
-    bg_color_handler = gnc_table_model_get_bg_color_handler (table->model,
-            handler_name);
-
-    if (!bg_color_handler)
-        return COLOR_UNKNOWN_BG;
+    color_handler = gnc_table_model_get_cell_color_handler (table->model,
+                                                            handler_name);
 
-    return bg_color_handler (virt_loc, hatching,
-                             table->model->handler_user_data);
-}
+    if (!color_handler)
+        return COLOR_UNDEFINED;
 
-guint32
-gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
-                        gboolean *hatching)
-{
-    return gnc_table_get_bg_color_internal (table, virt_loc, hatching);
+    return color_handler (virt_loc, hatching,
+                          table->model->handler_user_data);
 }
 
 void
diff --git a/gnucash/register/register-core/table-allgui.h b/gnucash/register/register-core/table-allgui.h
index d827fd5..3b4fa26 100644
--- a/gnucash/register/register-core/table-allgui.h
+++ b/gnucash/register/register-core/table-allgui.h
@@ -179,35 +179,19 @@ struct table
 };
 
 /** Color definitions used for table elements */
-typedef enum
-{
-    /* Colors used for background drawing */
-    COLOR_UNKNOWN_BG,          // 0
-    COLOR_HEADER_BG,           // 1
-    COLOR_PRIMARY_BG,          // 2
-    COLOR_PRIMARY_BG_ACTIVE,   // 3
-    COLOR_SECONDARY_BG,        // 4
-    COLOR_SECONDARY_BG_ACTIVE, // 5
-    COLOR_SPLIT_BG,            // 6
-    COLOR_SPLIT_BG_ACTIVE,     // 7
-
-    /* Colors used for foreground drawing (text etc)
-     * ATTENTION: the background and foreground lists should have
-     *            the same types (the same amount of entries) !
-     *            The code relies on this ! */
-    COLOR_UNKNOWN_FG,          // 8
-    COLOR_HEADER_FG,           // 9
-    COLOR_PRIMARY_FG,          // 10
-    COLOR_PRIMARY_FG_ACTIVE,   // 11
-    COLOR_SECONDARY_FG,        // 12
-    COLOR_SECONDARY_FG_ACTIVE, // 13
-    COLOR_SPLIT_FG,            // 14
-    COLOR_SPLIT_FG_ACTIVE,     // 15
-
-    /* Other colors */
-    COLOR_NEGATIVE,            // 16 Color to use for negative numbers
+typedef enum {
+    COLOR_UNDEFINED = 0,      // 0
+    COLOR_HEADER,             // 1
+    COLOR_PRIMARY,            // 2
+    COLOR_PRIMARY_ACTIVE,     // 3
+    COLOR_SECONDARY,          // 4
+    COLOR_SECONDARY_ACTIVE,   // 5
+    COLOR_SPLIT,              // 6
+    COLOR_SPLIT_ACTIVE,       // 7
+    COLOR_NEGATIVE = 16,      // 16
 } RegisterColor;
 
+
 /** Set the default gui handlers used by new tables. */
 void gnc_table_set_default_gui_handlers (TableGUIHandlers *gui_handlers);
 
@@ -258,9 +242,7 @@ const char *   gnc_table_get_label (Table *table, VirtualLocation virt_loc);
 
 CellIOFlags    gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc);
 
-guint32        gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc);
-
-guint32        gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
+guint32        gnc_table_get_color (Table *table, VirtualLocation virt_loc,
                                        gboolean *hatching);
 
 void           gnc_table_get_borders (Table *table, VirtualLocation virt_loc,

commit 7a2c1492fd05691db88c7fb0cb10572cf0b786d1
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:20:35 2017 +0000

    Replace the cell foreground and background colour handlers
    
    By using CSS classes, there is no need to have separate handlers for
    the foreground and background colours so replace them with one being of
    a similar format to that of cell_border_handlers.

diff --git a/gnucash/register/register-core/table-model.c b/gnucash/register/register-core/table-model.c
index c76310e..a5baee2 100644
--- a/gnucash/register/register-core/table-model.c
+++ b/gnucash/register/register-core/table-model.c
@@ -134,8 +134,7 @@ gnc_table_model_new (void)
     model->label_handlers = gnc_table_model_handler_hash_new ();
     model->help_handlers = gnc_table_model_handler_hash_new ();
     model->io_flags_handlers = gnc_table_model_handler_hash_new ();
-    model->fg_color_handlers = gnc_table_model_handler_hash_new ();
-    model->bg_color_handlers = gnc_table_model_handler_hash_new ();
+    model->cell_color_handlers = gnc_table_model_handler_hash_new ();
     model->cell_border_handlers = gnc_table_model_handler_hash_new ();
     model->confirm_handlers = gnc_table_model_handler_hash_new ();
     model->save_handlers = gnc_table_model_handler_hash_new ();
@@ -165,11 +164,8 @@ gnc_table_model_destroy (TableModel *model)
     gnc_table_model_handler_hash_destroy (model->io_flags_handlers);
     model->io_flags_handlers = NULL;
 
-    gnc_table_model_handler_hash_destroy (model->fg_color_handlers);
-    model->fg_color_handlers = NULL;
-
-    gnc_table_model_handler_hash_destroy (model->bg_color_handlers);
-    model->bg_color_handlers = NULL;
+    gnc_table_model_handler_hash_destroy (model->cell_color_handlers);
+    model->cell_color_handlers = NULL;
 
     gnc_table_model_handler_hash_destroy (model->cell_border_handlers);
     model->cell_border_handlers = NULL;
@@ -334,75 +330,39 @@ gnc_table_model_get_io_flags_handler (TableModel *model,
 }
 
 void
-gnc_table_model_set_fg_color_handler
+gnc_table_model_set_cell_color_handler
 (TableModel *model,
- TableGetFGColorHandler fg_color_handler,
+ TableGetCellColorHandler color_handler,
  const char * cell_name)
 {
     g_return_if_fail (model != NULL);
     g_return_if_fail (cell_name != NULL);
 
-    gnc_table_model_handler_hash_insert (model->fg_color_handlers,
+    gnc_table_model_handler_hash_insert (model->cell_color_handlers,
                                          cell_name,
-                                         fg_color_handler);
+                                         color_handler);
 }
 
 void
-gnc_table_model_set_default_fg_color_handler
+gnc_table_model_set_default_cell_color_handler
 (TableModel *model,
- TableGetFGColorHandler fg_color_handler)
+ TableGetCellColorHandler color_handler)
 {
     g_return_if_fail (model != NULL);
 
-    gnc_table_model_handler_hash_insert (model->fg_color_handlers,
+    gnc_table_model_handler_hash_insert (model->cell_color_handlers,
                                          DEFAULT_HANDLER,
-                                         fg_color_handler);
-}
-
-TableGetFGColorHandler
-gnc_table_model_get_fg_color_handler (TableModel *model,
-                                      const char * cell_name)
-{
-    g_return_val_if_fail (model != NULL, NULL);
-
-    return gnc_table_model_handler_hash_lookup (model->fg_color_handlers,
-            cell_name);
+                                         color_handler);
 }
 
-void
-gnc_table_model_set_bg_color_handler
-(TableModel *model,
- TableGetBGColorHandler bg_color_handler,
- const char * cell_name)
-{
-    g_return_if_fail (model != NULL);
-    g_return_if_fail (cell_name != NULL);
-
-    gnc_table_model_handler_hash_insert (model->bg_color_handlers,
-                                         cell_name,
-                                         bg_color_handler);
-}
-
-void
-gnc_table_model_set_default_bg_color_handler
-(TableModel *model,
- TableGetBGColorHandler bg_color_handler)
-{
-    g_return_if_fail (model != NULL);
-
-    gnc_table_model_handler_hash_insert (model->bg_color_handlers,
-                                         DEFAULT_HANDLER,
-                                         bg_color_handler);
-}
-
-TableGetBGColorHandler
-gnc_table_model_get_bg_color_handler (TableModel *model,
-                                      const char * cell_name)
+TableGetCellColorHandler
+gnc_table_model_get_cell_color_handler (TableModel *model,
+                                   const char * cell_name)
 {
     g_return_val_if_fail (model != NULL, NULL);
 
-    return gnc_table_model_handler_hash_lookup (model->bg_color_handlers,
-            cell_name);
+    return gnc_table_model_handler_hash_lookup (model->cell_color_handlers,
+                                                cell_name);
 }
 
 void
diff --git a/gnucash/register/register-core/table-model.h b/gnucash/register/register-core/table-model.h
index 268757e..2d489a6 100644
--- a/gnucash/register/register-core/table-model.h
+++ b/gnucash/register/register-core/table-model.h
@@ -76,10 +76,7 @@ typedef char * (*TableGetHelpHandler) (VirtualLocation virt_loc,
 typedef CellIOFlags (*TableGetCellIOFlagsHandler) (VirtualLocation virt_loc,
         gpointer user_data);
 
-typedef guint32 (*TableGetFGColorHandler) (VirtualLocation virt_loc,
-        gpointer user_data);
-
-typedef guint32 (*TableGetBGColorHandler) (VirtualLocation virt_loc,
+typedef guint32 (*TableGetCellColorHandler) (VirtualLocation virt_loc,
         gboolean *hatching,
         gpointer user_data);
 
@@ -107,8 +104,7 @@ typedef struct
     GHashTable *label_handlers;
     GHashTable *help_handlers;
     GHashTable *io_flags_handlers;
-    GHashTable *fg_color_handlers;
-    GHashTable *bg_color_handlers;
+    GHashTable *cell_color_handlers;
     GHashTable *cell_border_handlers;
     GHashTable *confirm_handlers;
 
@@ -189,25 +185,14 @@ TableGetCellIOFlagsHandler gnc_table_model_get_io_flags_handler
 (TableModel *model,
  const char * cell_name);
 
-void gnc_table_model_set_fg_color_handler
-(TableModel *model,
- TableGetFGColorHandler io_flags_handler,
- const char * cell_name);
-void gnc_table_model_set_default_fg_color_handler
-(TableModel *model,
- TableGetFGColorHandler io_flags_handler);
-TableGetFGColorHandler gnc_table_model_get_fg_color_handler
-(TableModel *model,
- const char * cell_name);
-
-void gnc_table_model_set_bg_color_handler
+void gnc_table_model_set_cell_color_handler
 (TableModel *model,
- TableGetBGColorHandler io_flags_handler,
+ TableGetCellColorHandler io_flags_handler,
  const char * cell_name);
-void gnc_table_model_set_default_bg_color_handler
+ void gnc_table_model_set_default_cell_color_handler
 (TableModel *model,
- TableGetBGColorHandler io_flags_handler);
-TableGetBGColorHandler gnc_table_model_get_bg_color_handler
+ TableGetCellColorHandler io_flags_handler);
+TableGetCellColorHandler gnc_table_model_get_cell_color_handler
 (TableModel *model,
  const char * cell_name);
 

commit 451161837d7d6d51a4775298e4a9ea671fc4724f
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:17:19 2017 +0000

    Test the widget state to get the correct background colour.
    
    When the cell borders are not displayed, the border colour is set to
    the background colour so test for the widget being in an insensitive
    state to get the correct background colour.

diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c
index 2abe7d7..7631caa 100644
--- a/gnucash/register/register-gnome/gnucash-sheet-private.c
+++ b/gnucash/register/register-gnome/gnucash-sheet-private.c
@@ -418,7 +418,10 @@ draw_cell (GnucashSheet *sheet,
     gtk_render_background (stylectxt, cr, x, y, width, height);
 
     gdk_rgba_parse (&color, "black");
-    gnc_style_context_get_background_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
+    if (gtk_style_context_get_state (stylectxt) == GTK_STATE_FLAG_INSENSITIVE)
+        gnc_style_context_get_background_color (stylectxt, GTK_STATE_FLAG_INSENSITIVE, &color);
+    else
+        gnc_style_context_get_background_color (stylectxt, GTK_STATE_FLAG_NORMAL, &color);
     bg_color = &color;
 
     get_cell_borders (sheet, virt_loc, &borders);

commit c5fb0d6dce7731e040e5c6f8ae811b0a77c2f0cd
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:14:51 2017 +0000

    Change the look of the toggle button
    
    With these changes the button image is removed and you are left with
    the arrow and frame on the yellow background. This can be dropped or
    adjusted if it was deemed a good idea.

diff --git a/gnucash/gnucash-310.css b/gnucash/gnucash-310.css
index e6b218d..76b7232 100644
--- a/gnucash/gnucash-310.css
+++ b/gnucash/gnucash-310.css
@@ -27,7 +27,7 @@
   padding: 2px 2px 2px 2px; /* all work with different values, around the text blue area */
 }
 
-.cursor .button {
+.cursor .toggle-button {
   margin: 1px 1px 1px 1px; /* does not work, not used, here for completeness */
 }
 
diff --git a/gnucash/gnucash-320.css b/gnucash/gnucash-320.css
index 4f4ea09..51f197c 100644
--- a/gnucash/gnucash-320.css
+++ b/gnucash/gnucash-320.css
@@ -18,7 +18,7 @@ cursor entry {
   padding: 0px 2px 0px 2px;
 }
 
-cursor button {
+cursor toggle-button {
   margin: 1px 1px 1px 1px;
 }
 
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 4162532..acbc323 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -138,7 +138,8 @@ gnc_item_edit_tb_class_init (GncItemEditTbClass *gnc_item_edit_tb_class)
     GtkWidgetClass *widget_class;
 
 #if GTK_CHECK_VERSION(3,20,0)
-    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_tb_class), "button");
+//    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_tb_class), "button");
+    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_tb_class), "toggle-button");
 #endif
 
     gnc_item_edit_tb_parent_class = g_type_class_peek_parent (gnc_item_edit_tb_class);
@@ -200,7 +201,8 @@ gnc_item_edit_tb_new (GnucashSheet *sheet)
                            NULL);
 
     // This sets a style class for when Gtk+ version is less than 3.20
-    gnc_widget_set_css_name (GTK_WIDGET(item_edit_tb), "button");
+//    gnc_widget_set_css_name (GTK_WIDGET(item_edit_tb), "button");
+    gnc_widget_set_css_name (GTK_WIDGET(item_edit_tb), "toggle-button");
 
     context = gtk_widget_get_style_context (GTK_WIDGET(item_edit_tb));
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
@@ -569,6 +571,9 @@ draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
 
     gtk_render_background (context, cr, 0, 0, width, height);
 
+    gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
+    gtk_render_frame (context, cr, 1, 1, width - 2, height - 2);
+
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_ARROW);
 
     size = MIN(width / 2, height / 2);

commit 550021130522b2fb4117bc75879e9cdda7d3866f
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:12:01 2017 +0000

    Control the toggle button width
    
    There did not seem to be an easier way to control the toggle button
    width so created a custom one based on the GtkToggleButton. This
    allowed the use of the class function get_preferred_width which is set
    at two thirds the height.

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 813088f..4162532 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -58,6 +58,155 @@ enum
 
 static GtkBoxClass *gnc_item_edit_parent_class;
 
+static GtkToggleButtonClass *gnc_item_edit_tb_parent_class;
+
+static void
+gnc_item_edit_tb_init (GncItemEditTb *item_edit_tb)
+{
+    item_edit_tb->sheet = NULL;
+}
+
+static void
+gnc_item_edit_tb_get_property (GObject *object,
+                               guint param_id,
+                               GValue *value,
+                               GParamSpec *pspec)
+{
+    GncItemEditTb *item_edit_tb = GNC_ITEM_EDIT_TB (object);
+
+    switch (param_id)
+    {
+    case PROP_SHEET:
+        g_value_take_object (value, item_edit_tb->sheet);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+gnc_item_edit_tb_set_property (GObject *object,
+                               guint param_id,
+                               const GValue *value,
+                               GParamSpec *pspec)
+{
+    GncItemEditTb *item_edit_tb = GNC_ITEM_EDIT_TB (object);
+
+    switch (param_id)
+    {
+    case PROP_SHEET:
+        item_edit_tb->sheet = GNUCASH_SHEET (g_value_get_object (value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+        break;
+    }
+}
+
+static void
+gnc_item_edit_tb_get_preferred_width (GtkWidget *widget,
+                                   gint *minimal_width,
+                                   gint *natural_width)
+{
+    GncItemEditTb *tb = GNC_ITEM_EDIT_TB (widget);
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(tb->sheet->item_editor);
+    gint x, y, w, h, width = 0;
+    gnc_item_edit_get_pixel_coords (GNC_ITEM_EDIT (item_edit), &x, &y, &w, &h);
+    width = ((h - 2)*2)/3;
+    if (width < 20) // minimum size for a button
+        width = 20;
+    *minimal_width = *natural_width = width;
+}
+
+static void
+gnc_item_edit_tb_get_preferred_height (GtkWidget *widget,
+                                    gint *minimal_width,
+                                    gint *natural_width)
+{
+    GncItemEditTb *tb = GNC_ITEM_EDIT_TB (widget);
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(tb->sheet->item_editor);
+    gint x, y, w, h;
+    gnc_item_edit_get_pixel_coords (GNC_ITEM_EDIT (item_edit), &x, &y, &w, &h);
+    *minimal_width = *natural_width = (h - 2);
+}
+
+static void
+gnc_item_edit_tb_class_init (GncItemEditTbClass *gnc_item_edit_tb_class)
+{
+    GObjectClass  *object_class;
+    GtkWidgetClass *widget_class;
+
+#if GTK_CHECK_VERSION(3,20,0)
+    gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_tb_class), "button");
+#endif
+
+    gnc_item_edit_tb_parent_class = g_type_class_peek_parent (gnc_item_edit_tb_class);
+
+    object_class = G_OBJECT_CLASS (gnc_item_edit_tb_class);
+    widget_class = GTK_WIDGET_CLASS (gnc_item_edit_tb_class);
+
+    object_class->get_property = gnc_item_edit_tb_get_property;
+    object_class->set_property = gnc_item_edit_tb_set_property;
+
+    g_object_class_install_property (object_class,
+                                     PROP_SHEET,
+                                     g_param_spec_object ("sheet",
+                                             "Sheet Value",
+                                             "Sheet Value",
+                                             GNUCASH_TYPE_SHEET,
+                                             G_PARAM_READWRITE));
+
+    /* GtkWidget method overrides */
+    widget_class->get_preferred_width = gnc_item_edit_tb_get_preferred_width;
+    widget_class->get_preferred_height = gnc_item_edit_tb_get_preferred_height;
+}
+
+GType
+gnc_item_edit_tb_get_type (void)
+{
+    static GType gnc_item_edit_tb_type = 0;
+
+    if (!gnc_item_edit_tb_type)
+    {
+        static const GTypeInfo gnc_item_edit_tb_info =
+        {
+            sizeof (GncItemEditTbClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_item_edit_tb_class_init,
+            NULL,
+            NULL,
+            sizeof (GncItemEditTb),
+            0, /* n_preallocs */
+            (GInstanceInitFunc) gnc_item_edit_tb_init,
+            NULL,
+        };
+        gnc_item_edit_tb_type =
+            g_type_register_static(GTK_TYPE_TOGGLE_BUTTON,
+                                   "GncItemEditTb",
+                                   &gnc_item_edit_tb_info, 0);
+    }
+    return gnc_item_edit_tb_type;
+}
+
+GtkWidget *
+gnc_item_edit_tb_new (GnucashSheet *sheet)
+{
+    GtkStyleContext *context;
+    GncItemEditTb *item_edit_tb =
+            g_object_new (GNC_TYPE_ITEM_EDIT_TB,
+                          "sheet", sheet,
+                           NULL);
+
+    // This sets a style class for when Gtk+ version is less than 3.20
+    gnc_widget_set_css_name (GTK_WIDGET(item_edit_tb), "button");
+
+    context = gtk_widget_get_style_context (GTK_WIDGET(item_edit_tb));
+    gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
+
+    return GTK_WIDGET(item_edit_tb);
+}
 
 /*
  * Returns the coordinates for the editor bounding box
@@ -722,7 +871,7 @@ gnc_item_edit_new (GnucashSheet *sheet)
     /* Create the popup button
        It will only be displayed when the cell being edited provides
        a popup item (like a calendar or account list) */
-    item_edit->popup_toggle.tbutton = gtk_toggle_button_new();
+    item_edit->popup_toggle.tbutton = gnc_item_edit_tb_new (sheet);
     gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE);
 
     /* Wrap the popup button in an event box to give it its own gdkwindow.
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 45d1502..2be4d24 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -37,6 +37,10 @@
 #define GNC_ITEM_EDIT_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))
 #define GNC_IS_ITEM_EDIT(o)       (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT))
 
+#define GNC_TYPE_ITEM_EDIT_TB        (gnc_item_edit_tb_get_type ())
+#define GNC_ITEM_EDIT_TB(o)          (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTb))
+#define GNC_ITEM_EDIT_TB_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTbClass))
+#define GNC_IS_ITEM_EDIT_TB(o)       (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT_TB))
 
 typedef int (*PopupGetHeight) (GtkWidget *item,
                                int space_available,
@@ -102,6 +106,19 @@ typedef struct
     GtkBoxClass parent_class;
 } GncItemEditClass;
 
+typedef struct
+{
+    GtkToggleButton tb;
+    GnucashSheet *sheet;
+} GncItemEditTb;
+
+typedef struct
+{
+    GtkToggleButtonClass parent_class;
+
+    void (* toggled) (GncItemEditTb *item_edit_tb);
+} GncItemEditTbClass;
+
 typedef enum
 {
     left,
@@ -145,5 +162,8 @@ void gnc_item_edit_focus_out (GncItemEdit *item_edit);
 gint gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side);
 gint gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side);
 
+GType gnc_item_edit_tb_get_type (void);
+GtkWidget *gnc_item_edit_tb_new (GnucashSheet *sheet);
+
 /** @} */
 #endif /* GNUCASH_ITEM_EDIT_H */

commit 0c443836966fa9fcc93c9510d93c7229515e049e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:09:37 2017 +0000

    Move the double line to be inside the cursor cell

diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c
index 92fbe35..2abe7d7 100644
--- a/gnucash/register/register-gnome/gnucash-sheet-private.c
+++ b/gnucash/register/register-gnome/gnucash-sheet-private.c
@@ -682,7 +682,7 @@ gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr)
     cairo_stroke (cr);
 
     // make the bottom line thicker
-    cairo_move_to (cr, cursor->x - x + 0.5, cursor->y - y + cursor->h - 1.5);
+    cairo_move_to (cr, cursor->x - x + 0.5, cursor->y - y + cursor->h - 3.5);
     cairo_rel_line_to (cr, cursor->w, 0);
     cairo_set_line_width (cr, 1.0);
     cairo_stroke (cr);

commit 2a938425748d73f72aa76849544942869f908fda
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:08:02 2017 +0000

    If a font size is specified for the sheet, popup size may be wrong
    
    When you specify a font size for the sheet, the popup will inherit this
    but when first popped it will use the minimum height value and so may
    be different resulting in not being in the right position. So check on
    allocation and if different remove and pop again.

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 2293bd2..813088f 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -742,6 +742,25 @@ gnc_item_edit_new (GnucashSheet *sheet)
     return GTK_WIDGET(item_edit);
 }
 
+static void
+check_popup_height_is_true (GtkWidget    *widget,
+                            GdkRectangle *allocation,
+                            gpointer user_data)
+{
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(user_data);
+    GnucashSheet *sheet = item_edit->sheet;
+
+    // if a larger font is specified in css for the sheet, the popup returned height value
+    // on first pop does not reflect the true height but the minimum height so just to be
+    // sure check this value against the allocated one.
+    if (allocation->height != item_edit->popup_returned_height)
+    {
+        gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
+
+        g_idle_add_full (G_PRIORITY_HIGH_IDLE,
+                        (GSourceFunc) gnc_item_edit_update, item_edit, NULL);
+    }
+}
 
 void
 gnc_item_edit_show_popup (GncItemEdit *item_edit)
@@ -810,6 +829,11 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
     if (!gtk_widget_get_parent (item_edit->popup_item))
         gtk_layout_put (GTK_LAYOUT(sheet), item_edit->popup_item, popup_x, popup_y);
 
+    // Lets check popup height is the true height
+    item_edit->popup_returned_height = popup_h;
+    g_signal_connect_after (item_edit->popup_item, "size-allocate",
+                            G_CALLBACK(check_popup_height_is_true), item_edit);
+
     gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
 
     toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 7d37378..45d1502 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -85,6 +85,7 @@ typedef struct
     PopupPostShow    popup_post_show;
     PopupGetWidth    popup_get_width;
     gpointer         popup_user_data;
+    gint             popup_returned_height;
 
     GtkBorder        padding;
     GtkBorder        margin;

commit a278bcc05221e33409248b35e4c0c452f4b1d824
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:05:46 2017 +0000

    Use previously created functions
    
    Use the previously created functions to reduce code and for conformity.
    As part of this some variables were renamed to be common.

diff --git a/gnucash/register/register-gnome/gnucash-header.c b/gnucash/register/register-gnome/gnucash-header.c
index 247d08f..f279971 100644
--- a/gnucash/register/register-gnome/gnucash-header.c
+++ b/gnucash/register/register-gnome/gnucash-header.c
@@ -69,6 +69,7 @@ static void
 gnc_header_draw_offscreen (GncHeader *header)
 {
     SheetBlockStyle *style = header->style;
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(header->sheet->item_editor);
     Table *table = header->sheet->table;
     VirtualLocation virt_loc;
     VirtualCell *vcell;
@@ -125,7 +126,7 @@ gnc_header_draw_offscreen (GncHeader *header)
     for (i = 0; i < style->nrows; i++)
     {
         int col_offset = 0;
-        int h = 0, j;
+        int height = 0, j;
         virt_loc.phys_row_offset = i;
 
         /* TODO: This routine is duplicated in several places.
@@ -139,26 +140,29 @@ gnc_header_draw_offscreen (GncHeader *header)
             double text_x, text_y, text_w, text_h;
             BasicCell *cell;
             const char *text;
-            int w;
+            int width;
             PangoLayout *layout;
+            PangoRectangle logical_rect;
+            GdkRectangle rect;
+            int x_offset;
 
             virt_loc.phys_col_offset = j;
 
             cd = gnucash_style_get_cell_dimensions (style, i, j);
-            h = cd->pixel_height;
+            height = cd->pixel_height;
             if (header->in_resize && (j == header->resize_col))
-                w = header->resize_col_width;
+                width = header->resize_col_width;
             else
-                w = cd->pixel_width;
+                width = cd->pixel_width;
 
             cell = gnc_cellblock_get_cell (cb, i, j);
             if (!cell || !cell->cell_name)
             {
-                col_offset += w;
+                col_offset += width;
                 continue;
             }
 
-            cairo_rectangle (cr, col_offset - 0.5, row_offset + 0.5, w, h);
+            cairo_rectangle (cr, col_offset - 0.5, row_offset + 0.5, width, height);
             cairo_set_line_width (cr, 1.0);
             cairo_stroke (cr);
 
@@ -169,38 +173,28 @@ gnc_header_draw_offscreen (GncHeader *header)
                 text = "";
 
             layout = gtk_widget_create_pango_layout (GTK_WIDGET (header->sheet), text);
-            switch (gnc_table_get_align (table, virt_loc))
-            {
-            default:
-            case CELL_ALIGN_LEFT:
-                pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
-                break;
-
-            case CELL_ALIGN_RIGHT:
-                pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
-                break;
-
-            case CELL_ALIGN_CENTER:
-                pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
-                break;
-            }
 
-            text_x = col_offset + CELL_HPADDING;
-            text_y = row_offset + 1;
-            text_w = MAX (0, w - (2 * CELL_HPADDING));
-            text_h = h - 2;
+            pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+
+            gnucash_sheet_set_text_bounds (header->sheet, &rect,
+                                           col_offset, row_offset, width, height);
+
             cairo_save (cr);
-            cairo_rectangle (cr, text_x, text_y, text_w, text_h);
+            cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
             cairo_clip (cr);
 
-            gtk_render_layout (stylectxt, cr, text_x, text_y, layout);
+            x_offset = gnucash_sheet_get_text_offset (header->sheet, virt_loc,
+                                                      rect.width, logical_rect.width);
+
+            gtk_render_layout (stylectxt, cr, rect.x + x_offset,
+                               rect.y + gnc_item_edit_get_padding_border (item_edit, top), layout);
 
             cairo_restore (cr);
             g_object_unref (layout);
 
-            col_offset += w;
+            col_offset += width;
         }
-        row_offset += h;
+        row_offset += height;
     }
     gtk_style_context_restore (stylectxt);
 
diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c
index 955f607..92fbe35 100644
--- a/gnucash/register/register-gnome/gnucash-sheet-private.c
+++ b/gnucash/register/register-gnome/gnucash-sheet-private.c
@@ -381,6 +381,7 @@ draw_cell (GnucashSheet *sheet,
            cairo_t *cr,
            int x, int y, int width, int height)
 {
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
     Table *table = sheet->table;
     PhysicalCellBorders borders;
     const char *text;
@@ -524,39 +525,19 @@ draw_cell (GnucashSheet *sheet,
         goto exit;
     }
 
-    pango_layout_get_pixel_extents(layout,
-                                   NULL,
-                                   &logical_rect);
+    pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
 
-    rect.x      = x + CELL_HPADDING;
-    rect.y      = y + CELL_VPADDING;
-    rect.width  = MAX (0, width - (2 * CELL_HPADDING));
-    rect.height = height - 2;
+    gnucash_sheet_set_text_bounds (sheet, &rect, x, y, width, height);
 
     cairo_save (cr);
     cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
     cairo_clip (cr);
 
-    switch (gnc_table_get_align (table, virt_loc))
-    {
-    default:
-    case CELL_ALIGN_LEFT:
-        x_offset = 0;
-        break;
-
-    case CELL_ALIGN_RIGHT:
-        x_offset = width - 2 * CELL_HPADDING - logical_rect.width - 3;
-        break;
-
-    case CELL_ALIGN_CENTER:
-        if (logical_rect.width > width - 2 * CELL_HPADDING)
-            x_offset = 0;
-        else
-            x_offset = (width - 2 * CELL_HPADDING -
-                        logical_rect.width) / 2;
-        break;
-    }
-    gtk_render_layout (stylectxt, cr, rect.x + x_offset + 1, rect.y, layout);
+    x_offset = gnucash_sheet_get_text_offset (sheet, virt_loc,
+                                              rect.width, logical_rect.width);
+
+    gtk_render_layout (stylectxt, cr, rect.x + x_offset,
+                       rect.y + gnc_item_edit_get_padding_border (item_edit, top), layout);
 
     cairo_restore (cr);
 
diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 6db5367..5a66605 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -312,7 +312,7 @@ gnucash_sheet_get_text_cursor_position (GnucashSheet *sheet, const VirtualLocati
     PangoLayout *layout;
     PangoRectangle logical_rect;
     GdkRectangle rect;
-    gint x, y, w, h;
+    gint x, y, width, height;
     gint index, trailing;
     gboolean result;
     gint x_offset = 0;
@@ -321,7 +321,7 @@ gnucash_sheet_get_text_cursor_position (GnucashSheet *sheet, const VirtualLocati
         return 0;
 
     // Get the item_edit position
-    gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
+    gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &width, &height);
 
     layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), text);
 
@@ -330,35 +330,14 @@ gnucash_sheet_get_text_cursor_position (GnucashSheet *sheet, const VirtualLocati
 
     pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
 
-    rect.x      = x + CELL_HPADDING;
-    rect.y      = y + CELL_VPADDING;
-    rect.width  = MAX (0, w - (2 * CELL_HPADDING));
-    rect.height = h - 2;
+    gnucash_sheet_set_text_bounds (sheet, &rect, x, y, width, height);
 
-    // Get the alignment of the cell
-    switch (gnc_table_get_align (table, virt_loc))
-    {
-    default:
-    case CELL_ALIGN_LEFT:
-        x_offset = 0;
-        break;
-
-    case CELL_ALIGN_RIGHT:
-        x_offset = w - 2 * CELL_HPADDING - logical_rect.width - 3;
-        break;
-
-    case CELL_ALIGN_CENTER:
-        if (logical_rect.width > w - 2 * CELL_HPADDING)
-            x_offset = 0;
-        else
-            x_offset = (w - 2 * CELL_HPADDING -
-                        logical_rect.width) / 2;
-        break;
-    }
+    x_offset = gnucash_sheet_get_text_offset (sheet, virt_loc,
+                                              rect.width, logical_rect.width);
 
     result = pango_layout_xy_to_index (layout,
                  PANGO_SCALE * (sheet->button_x - rect.x - x_offset),
-                 PANGO_SCALE * (h/2), &index, &trailing);
+                 PANGO_SCALE * (height/2), &index, &trailing);
 
     g_object_unref (layout);
 
@@ -2231,6 +2210,7 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
     SheetBlock *block;
     SheetBlockStyle *style;
     PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), "");
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
 
     g_return_val_if_fail (virt_col >= 0, 0);
     g_return_val_if_fail (virt_col < sheet->num_virt_cols, 0);
diff --git a/gnucash/register/register-gnome/gnucash-sheet.h b/gnucash/register/register-gnome/gnucash-sheet.h
index 68b3c70..f729e8f 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.h
+++ b/gnucash/register/register-gnome/gnucash-sheet.h
@@ -33,10 +33,6 @@
  * @brief Public declarations of GnucashSheet class.
  */
 
-#define CELL_VPADDING 2
-#define CELL_HPADDING 5
-
-
 #define GNUCASH_TYPE_SHEET     (gnucash_sheet_get_type ())
 #define GNUCASH_SHEET(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_SHEET, GnucashSheet))
 #define GNUCASH_SHEET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_SHEET))

commit 0ba9b768996e3214d66d37b8b5a46d71ba4fb74d
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 12:01:54 2017 +0000

    Provide two functions for common code
    
    These two sections of code appear in three separate files in slightly
    different versions so define them hear for conformity

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index d8a6cea..6db5367 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -261,6 +261,47 @@ gnucash_sheet_deactivate_cursor_cell (GnucashSheet *sheet)
     gnucash_sheet_redraw_block (sheet, virt_loc.vcell_loc);
 }
 
+void
+gnucash_sheet_set_text_bounds (GnucashSheet *sheet, GdkRectangle *rect,
+                               gint x, gint y, gint width, gint height)
+{
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
+
+    rect->x = x + gnc_item_edit_get_margin (item_edit, left);
+    rect->y = y + gnc_item_edit_get_margin (item_edit, top);
+    rect->width = MAX (0, width - gnc_item_edit_get_margin (item_edit, left_right));
+    rect->height = height - gnc_item_edit_get_margin (item_edit, top_bottom);
+}
+
+gint
+gnucash_sheet_get_text_offset (GnucashSheet *sheet, const VirtualLocation virt_loc,
+                                gint rect_width, gint logical_width)
+{
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
+    Table *table = sheet->table;
+    gint x_offset = 0;
+
+    // Get the alignment of the cell
+    switch (gnc_table_get_align (table, virt_loc))
+    {
+    default:
+    case CELL_ALIGN_LEFT:
+        x_offset = gnc_item_edit_get_padding_border (item_edit, left);
+        break;
+
+    case CELL_ALIGN_RIGHT:
+        x_offset = rect_width - gnc_item_edit_get_padding_border (item_edit, right) - logical_width - 1;
+        break;
+
+    case CELL_ALIGN_CENTER:
+        if (logical_width > rect_width)
+            x_offset = 0;
+        else
+            x_offset = (rect_width - logical_width) / 2;
+        break;
+    }
+    return x_offset;
+}
 
 static gint
 gnucash_sheet_get_text_cursor_position (GnucashSheet *sheet, const VirtualLocation virt_loc)
@@ -2229,7 +2270,7 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
                 pango_layout_set_text (layout, text, strlen (text));
                 pango_layout_get_pixel_size (layout, &width, NULL);
 
-                width += 2 * CELL_HPADDING;
+                width += gnc_item_edit_get_margin (item_edit, left_right);
 
                 max = MAX (max, width);
             }
diff --git a/gnucash/register/register-gnome/gnucash-sheet.h b/gnucash/register/register-gnome/gnucash-sheet.h
index b571d03..68b3c70 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.h
+++ b/gnucash/register/register-gnome/gnucash-sheet.h
@@ -108,5 +108,11 @@ void gnucash_sheet_set_window (GnucashSheet *sheet, GtkWidget *window);
 void gnucash_get_style_classes (GnucashSheet *sheet, GtkStyleContext *stylectxt,
                                 RegisterColor field_type);
 
+void gnucash_sheet_set_text_bounds (GnucashSheet *sheet, GdkRectangle *rect,
+                                    gint x, gint y, gint width, gint height);
+
+gint gnucash_sheet_get_text_offset (GnucashSheet *sheet, const VirtualLocation virt_loc,
+                                    gint rect_width, gint logical_width);
+
 /** @} */
 #endif

commit 70ad2c3bc4f035512605154724228c90d90baa75
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 11:57:58 2017 +0000

    This function doesn't do much and is only used for new account registers
    
    This function is used to get the width of the toggle button and add it
    to the sample text length to set the default column width. As it is
    square, just use the row height instead and the user will no doubt set
    there own widths any way.

diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index fc44f6a..2293bd2 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -94,14 +94,6 @@ gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit,
     *y += yd;
 }
 
-
-int
-gnc_item_edit_get_toggle_offset (int row_height)
-{
-    /* sync with gnc_item_edit_update */
-    return row_height - (2 * (CELL_VPADDING + 1)) + 3;
-}
-
 static gboolean
 gnc_item_edit_update (GncItemEdit *item_edit)
 {
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index a2eae31..7d37378 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -133,8 +133,6 @@ void gnc_item_edit_set_popup (GncItemEdit    *item_edit,
 void gnc_item_edit_show_popup (GncItemEdit *item_edit);
 void gnc_item_edit_hide_popup (GncItemEdit *item_edit);
 
-int gnc_item_edit_get_toggle_offset (int row_height);
-
 void gnc_item_edit_cut_clipboard (GncItemEdit *item_edit);
 void gnc_item_edit_copy_clipboard (GncItemEdit *item_edit);
 void gnc_item_edit_paste_clipboard (GncItemEdit *item_edit);
diff --git a/gnucash/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c
index 2ef3c8f..e999620 100644
--- a/gnucash/register/register-gnome/gnucash-style.c
+++ b/gnucash/register/register-gnome/gnucash-style.c
@@ -215,9 +215,10 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
             if (cd->pixel_width > 0)
                 continue;
 
+            // This is used on new account popup cells to get the default
+            // width of text plus toggle button.
             if (cell && cell->is_popup)
-                width += gnc_item_edit_get_toggle_offset
-                         (cd->pixel_height);
+                width += cd->pixel_height; // toggle button is square, use cell height
 
             cd->pixel_width = MAX (cd->pixel_width, width);
         }

commit bb16e07d8f41e04f003ff6b18ad57cec907d5dff
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 11:56:12 2017 +0000

    Adjust the sheet to get its spacings from the item_edit CSS

diff --git a/gnucash/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c
index dcadb7c..2ef3c8f 100644
--- a/gnucash/register/register-gnome/gnucash-style.c
+++ b/gnucash/register/register-gnome/gnucash-style.c
@@ -169,6 +169,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
     int row, col;
     gint max_height = -1;
     PangoLayout *layout;
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
 
     /* g_return_if_fail (font != NULL); */
 
@@ -196,13 +197,17 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
                 layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), text);
                 pango_layout_get_pixel_size (layout, &width, &cd->pixel_height);
                 g_object_unref (layout);
-                width += 2 * CELL_HPADDING;
-                cd->pixel_height += 2 * CELL_VPADDING;
+                width += gnc_item_edit_get_margin (item_edit, left_right) +
+                         gnc_item_edit_get_padding_border (item_edit, left_right);
+
+                cd->pixel_height += gnc_item_edit_get_margin (item_edit, top_bottom) +
+                                    gnc_item_edit_get_padding_border (item_edit, top_bottom);
             }
             else
             {
                 width = 0;
-                cd->pixel_height = (2 * CELL_VPADDING);
+                cd->pixel_height = gnc_item_edit_get_margin (item_edit, top_bottom) +
+                                   gnc_item_edit_get_padding_border (item_edit, top_bottom);
             }
 
             max_height = MAX(max_height, cd->pixel_height);
@@ -239,6 +244,7 @@ static void
 set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
 {
     SheetBlockStyle *style;
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
     BlockDimensions *dimensions;
     CellDimensions *cd;
     GTable *cd_table;
@@ -315,7 +321,8 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
                 pango_layout_get_pixel_size (layout, &sample_width, NULL);
                 g_object_unref (layout);
                 /*sample_width = gdk_string_width (font, text);*/
-                sample_width += 2 * CELL_HPADDING;
+                sample_width += gnc_item_edit_get_margin (item_edit, left_right) +
+                                gnc_item_edit_get_padding_border (item_edit, left_right);
             }
             else
                 sample_width = 0;

commit 9f76441d5098b648baad60a5e51c41f571b72d48
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 1 11:54:05 2017 +0000

    Get the item_edit cell padding from CSS instead of defines
    
    This commit sets up getting the vertical and horizontal item_edit cell
    margins, borders and padding from CSS. This increases the option to
    specify individual values for top, right, bottom and left instead of
    just specifying just two values.

diff --git a/gnucash/gnucash-310.css b/gnucash/gnucash-310.css
index e4a37a3..e6b218d 100644
--- a/gnucash/gnucash-310.css
+++ b/gnucash/gnucash-310.css
@@ -21,13 +21,14 @@
   color: mix (currentColor, grey, 0.2);
 }
 
-/* Register Cursor padding settings, make sure entry matches sheet.h */
-cursor entry {
-  padding: 2px 5px 2px 5px;
+/* Register Cursor settings, top, right, bottom, left */
+.cursor .entry {
+  margin: 2px 5px 2px 5px;  /* this only works by doing it in code, yellow area */
+  padding: 2px 2px 2px 2px; /* all work with different values, around the text blue area */
 }
 
-cursor button {
-  padding: 1px 1px 1px 1px;
+.cursor .button {
+  margin: 1px 1px 1px 1px; /* does not work, not used, here for completeness */
 }
 
 /* Register defaults */
@@ -37,7 +38,7 @@ cursor button {
 @define-color register_split_bg_color #EDE7D3;
 @define-color register_cursor_bg_color #FFEF98;
 
-.register-header {
+*.register-header {
   background-color: @register_header_bg_color;
 }
 
diff --git a/gnucash/gnucash-320.css b/gnucash/gnucash-320.css
index d7e0495..4f4ea09 100644
--- a/gnucash/gnucash-320.css
+++ b/gnucash/gnucash-320.css
@@ -12,13 +12,14 @@
   color: @negative-numbers;
 }
 
-/* Register Cursor padding settings, make sure entry matches sheet.h */
+/* Register Cursor settings, top, right, bottom, left */
 cursor entry {
-  padding: 2px 5px 2px 5px;
+  margin: 2px 5px 2px 5px;
+  padding: 0px 2px 0px 2px;
 }
 
 cursor button {
-  padding: 1px 1px 1px 1px;
+  margin: 1px 1px 1px 1px;
 }
 
 /* Register defaults */
@@ -28,7 +29,7 @@ cursor button {
 @define-color register_split_bg_color #EDE7D3;
 @define-color register_cursor_bg_color #FFEF98;
 
-.register-header {
+*.register-header {
   background-color: @register_header_bg_color;
 }
 
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index 91aa497..fc44f6a 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -361,6 +361,7 @@ draw_background_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 static gboolean
 draw_text_cursor_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 {
+    GncItemEdit *item_edit = GNC_ITEM_EDIT(user_data);
     GtkEditable *editable = GTK_EDITABLE(widget);
     GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET(widget));
     gint height = gtk_widget_get_allocated_height (widget);
@@ -401,8 +402,15 @@ draw_text_cursor_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
     // Now draw a vertical line
     cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
     cairo_set_line_width (cr, 1.0);
-    cairo_move_to (cr, cursor_x + 0.5, 2);
-    cairo_rel_line_to (cr, 0, height - 4);
+#if GTK_CHECK_VERSION(3,20,0)
+    cairo_move_to (cr, cursor_x + 0.5, gnc_item_edit_get_margin (item_edit, top) +
+                                       gnc_item_edit_get_padding_border (item_edit, top));
+    cairo_rel_line_to (cr, 0, height - gnc_item_edit_get_margin (item_edit, top_bottom) -
+                                       gnc_item_edit_get_padding_border (item_edit, top_bottom));
+#else
+    cairo_move_to (cr, cursor_x + 0.5, gnc_item_edit_get_padding_border (item_edit, top));
+    cairo_rel_line_to (cr, 0, height - gnc_item_edit_get_padding_border (item_edit, top_bottom));
+#endif
     cairo_stroke (cr);
 
     return FALSE;
@@ -608,13 +616,60 @@ gnc_item_edit_get_type (void)
     return gnc_item_edit_type;
 }
 
+gint
+gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side)
+{
+    switch (side)
+    {
+    case left:
+        return item_edit->margin.left;
+    case right:
+        return item_edit->margin.right;
+    case top:
+        return item_edit->margin.top;
+    case bottom:
+        return item_edit->margin.bottom;
+    case left_right:
+        return item_edit->margin.left + item_edit->margin.right;
+    case top_bottom:
+        return item_edit->margin.top + item_edit->margin.bottom;
+    default:
+        return 2;
+    }
+}
+
+gint
+gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side)
+{
+    switch (side)
+    {
+    case left:
+        return item_edit->padding.left + item_edit->border.left;
+    case right:
+        return item_edit->padding.right + item_edit->border.right;
+    case top:
+        return item_edit->padding.top + item_edit->border.top;
+    case bottom:
+        return item_edit->padding.bottom + item_edit->border.bottom;
+    case left_right:
+        return item_edit->padding.left + item_edit->border.left +
+               item_edit->padding.right + item_edit->border.right;
+    case top_bottom:
+        return item_edit->padding.top + item_edit->border.top +
+               item_edit->padding.bottom + item_edit->border.bottom;
+    default:
+        return 2;
+    }
+}
 
 GtkWidget *
 gnc_item_edit_new (GnucashSheet *sheet)
 {
-    char *hpad_str, *vpad_str, *entry_css;
-    GtkStyleContext *stylecontext;
-    GtkCssProvider *provider;
+    GtkStyleContext *stylectxt;
+    GtkBorder padding;
+    GtkBorder margin;
+    GtkBorder border;
+    GtkWidget *vb = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     GncItemEdit *item_edit =
             g_object_new (GNC_TYPE_ITEM_EDIT,
                           "sheet", sheet,
@@ -630,32 +685,54 @@ gnc_item_edit_new (GnucashSheet *sheet)
     item_edit->editor = gtk_entry_new();
     sheet->entry = item_edit->editor;
     gtk_entry_set_width_chars (GTK_ENTRY(item_edit->editor), 1);
-    gtk_box_pack_start (GTK_BOX(item_edit), item_edit->editor,  TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX(item_edit), item_edit->editor, TRUE, TRUE, 0);
+
+    // Get the CSS space settings for the entry
+    stylectxt = gtk_widget_get_style_context (GTK_WIDGET(item_edit->editor));
+    gtk_style_context_get_padding (stylectxt, GTK_STATE_FLAG_NORMAL, &padding);
+    gtk_style_context_get_margin (stylectxt, GTK_STATE_FLAG_NORMAL, &margin);
+    gtk_style_context_get_border (stylectxt, GTK_STATE_FLAG_NORMAL, &border);
+
+    item_edit->padding = padding;
+    item_edit->margin = margin;
+    item_edit->border = border;
 
     // Make sure the Entry can not have focus and no frame
     gtk_widget_set_can_focus (GTK_WIDGET(item_edit->editor), FALSE);
     gtk_entry_set_has_frame (GTK_ENTRY(item_edit->editor), FALSE);
 
+#if !GTK_CHECK_VERSION(3,20,0)
+#if GTK_CHECK_VERSION(3,12,0)
+    gtk_widget_set_margin_start (GTK_WIDGET(item_edit->editor),
+                                 gnc_item_edit_get_margin (item_edit, left));
+    gtk_widget_set_margin_end (GTK_WIDGET(item_edit->editor),
+                               gnc_item_edit_get_margin (item_edit, right));
+#else
+    gtk_widget_set_margin_left (GTK_WIDGET(item_edit->editor),
+                                gnc_item_edit_get_margin (item_edit, left));
+    gtk_widget_set_margin_right (GTK_WIDGET(item_edit->editor),
+                                 gnc_item_edit_get_margin (item_edit, right));
+#endif
+    gtk_widget_set_margin_top (GTK_WIDGET(item_edit->editor),
+                               gnc_item_edit_get_margin (item_edit, top));
+    gtk_widget_set_margin_bottom (GTK_WIDGET(item_edit->editor),
+                                  gnc_item_edit_get_margin (item_edit, bottom));
+#endif
+
     // Connect to the draw signal so we can draw a cursor
     g_signal_connect_after (item_edit->editor, "draw",
-                            G_CALLBACK (draw_text_cursor_cb), NULL);
+                            G_CALLBACK (draw_text_cursor_cb), item_edit);
 
     // Fill in the background so the underlying sheet cell can not be seen
     g_signal_connect (item_edit, "draw",
                             G_CALLBACK (draw_background_cb), item_edit);
 
-    /* Force padding on the entry to align with the rest of the register this
-       is done in the gnucash.css file which should be in line with sheet.h */
-
     /* Create the popup button
        It will only be displayed when the cell being edited provides
        a popup item (like a calendar or account list) */
     item_edit->popup_toggle.tbutton = gtk_toggle_button_new();
     gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE);
 
-    /* Force padding on the button to keep it small and display as much as
-       possible of the arrow which is done in the gnucash.css file */
-
     /* Wrap the popup button in an event box to give it its own gdkwindow.
      * Without one the button would disappear behind the grid object. */
     item_edit->popup_toggle.ebox = gtk_event_box_new();
@@ -663,11 +740,13 @@ gnc_item_edit_new (GnucashSheet *sheet)
     gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.ebox),
                       item_edit->popup_toggle.tbutton);
 
-    gtk_box_pack_start (GTK_BOX(item_edit),
-                        item_edit->popup_toggle.ebox,
-                        FALSE, TRUE, 0);
-    gtk_widget_show_all(GTK_WIDGET(item_edit));
+    /* The button needs to be packed into a vertical box so that the height and position
+     * can be controlled in ealier than Gtk3.20 versions */
+    gtk_box_pack_start (GTK_BOX(vb), item_edit->popup_toggle.ebox,
+                        FALSE, FALSE, 0);
 
+    gtk_box_pack_start (GTK_BOX(item_edit), vb, FALSE, FALSE, 0);
+    gtk_widget_show_all(GTK_WIDGET(item_edit));
     return GTK_WIDGET(item_edit);
 }
 
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.h b/gnucash/register/register-gnome/gnucash-item-edit.h
index 7b8969a..a2eae31 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.h
+++ b/gnucash/register/register-gnome/gnucash-item-edit.h
@@ -86,6 +86,10 @@ typedef struct
     PopupGetWidth    popup_get_width;
     gpointer         popup_user_data;
 
+    GtkBorder        padding;
+    GtkBorder        margin;
+    GtkBorder        border;
+
     /* Where are we */
     VirtualLocation virt_loc;
 
@@ -97,6 +101,15 @@ typedef struct
     GtkBoxClass parent_class;
 } GncItemEditClass;
 
+typedef enum
+{
+    left,
+    right,
+    top,
+    bottom,
+    left_right,
+    top_bottom,
+} Sides;
 
 GType gnc_item_edit_get_type (void);
 
@@ -130,5 +143,8 @@ gboolean gnc_item_edit_get_has_selection (GncItemEdit *item_edit);
 void gnc_item_edit_focus_in (GncItemEdit *item_edit);
 void gnc_item_edit_focus_out (GncItemEdit *item_edit);
 
+gint gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side);
+gint gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side);
+
 /** @} */
 #endif /* GNUCASH_ITEM_EDIT_H */

commit c19f851c2958d6006a4d972ba320bf63ad8116d2
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 20:55:15 2017 +0200

    Add a bunch of translator comments and a few accelerators to glade files

diff --git a/src/gnome-utils/gtkbuilder/dialog-preferences.glade b/src/gnome-utils/gtkbuilder/dialog-preferences.glade
index 52060f7..1eae731 100644
--- a/src/gnome-utils/gtkbuilder/dialog-preferences.glade
+++ b/src/gnome-utils/gtkbuilder/dialog-preferences.glade
@@ -1462,7 +1462,7 @@ many months before the current month:</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes"><b>General</b></property>
+                    <property name="label" translatable="yes" comments="Preferences Dialog, General Tab"><b>General</b></property>
                     <property name="use_markup">True</property>
                   </object>
                   <packing>
@@ -2025,7 +2025,7 @@ many months before the current month:</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Time to wait for answer:</property>
+                    <property name="label" translatable="yes">Time to _wait for answer:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">pref/general/autosave-interval-minutes</property>
                   </object>
@@ -2910,7 +2910,7 @@ many months before the current month:</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Number of _characters for auto complete:</property>
+                    <property name="label" translatable="yes" comments="Register2 feature">Number of _characters for auto complete:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">pref/general.register/key-length</property>
                   </object>
@@ -2928,7 +2928,7 @@ many months before the current month:</property>
                     <property name="can_focus">True</property>
                     <property name="has_tooltip">True</property>
                     <property name="tooltip_markup">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
-                    <property name="tooltip_text" translatable="yes">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
+                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">This sets the number of characters before auto complete starts for description, notes and memo fields.</property>
                     <property name="invisible_char">●</property>
                     <property name="invisible_char_set">True</property>
                     <property name="primary_icon_activatable">False</property>
@@ -2952,12 +2952,12 @@ many months before the current month:</property>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="pref/general.register/show-extra-dates">
-                    <property name="label" translatable="yes">Show the _entered and reconcile dates</property>
+                    <property name="label" translatable="yes" comments="Register2 feature">Show the _entered and reconcile dates</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="tooltip_markup">Show the date when the transaction was entered below the posted date and reconciled date on split row.</property>
-                    <property name="tooltip_text" translatable="yes">Show the date when the transaction was entered below the posted date and reconciled date on split row.</property>
+                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">Show the date when the transaction was entered below the posted date and reconciled date on split row.</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2972,12 +2972,12 @@ many months before the current month:</property>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="pref/general.register/show-calendar-buttons">
-                    <property name="label" translatable="yes">Show the calendar b_uttons</property>
+                    <property name="label" translatable="yes" comments="Register2 feature">Show the calendar b_uttons</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="tooltip_markup">Show the calendar buttons Cancel, Today and Select.</property>
-                    <property name="tooltip_text" translatable="yes">Show the calendar buttons Cancel, Today and Select.</property>
+                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">Show the calendar buttons Cancel, Today and Select.</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -2992,12 +2992,12 @@ many months before the current month:</property>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="pref/general.register/selection-to-blank-on-expand">
-                    <property name="label" translatable="yes">_Move the selection to the blank split on expand</property>
+                    <property name="label" translatable="yes" comments="Register2 feature">_Move the selection to the blank split on expand</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="tooltip_markup">This will move the selection to the blank split when the transaction is expanded.</property>
-                    <property name="tooltip_text" translatable="yes">This will move the selection to the blank split when the transaction is expanded.</property>
+                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">This will move the selection to the blank split when the transaction is expanded.</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -3012,12 +3012,12 @@ many months before the current month:</property>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="pref/general.register/show-extra-dates-on-selection">
-                    <property name="label" translatable="yes">_Show entered and reconciled dates on selection</property>
+                    <property name="label" translatable="yes" comments="Register2 feature">_Show entered and reconciled dates on selection</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="tooltip_markup">Show the entered date and reconciled date on transaction selection.</property>
-                    <property name="tooltip_text" translatable="yes">Show the entered date and reconciled date on transaction selection.</property>
+                    <property name="tooltip_text" translatable="yes" comments="Register2 feature">Show the entered date and reconciled date on transaction selection.</property>
                     <property name="use_underline">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
diff --git a/src/gnome/gtkbuilder/gnc-plugin-page-register.glade b/src/gnome/gtkbuilder/gnc-plugin-page-register.glade
index b6fcdab..9f1e1c4 100644
--- a/src/gnome/gtkbuilder/gnc-plugin-page-register.glade
+++ b/src/gnome/gtkbuilder/gnc-plugin-page-register.glade
@@ -5,7 +5,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
-    <property name="title" translatable="yes">Duplicate Transaction</property>
+    <property name="title" translatable="yes" comments="Duplicate Transaction Dialog">Duplicate Transaction</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="type_hint">dialog</property>
@@ -207,7 +207,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
-    <property name="title" translatable="yes">Filter register by...</property>
+    <property name="title" translatable="yes" comments="Filter register by... Dialog">Filter register by...</property>
     <property name="resizable">False</property>
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">dialog</property>
@@ -274,7 +274,7 @@
                 <property name="border_width">12</property>
                 <child>
                   <object class="GtkRadioButton" id="filter_show_all">
-                    <property name="label" translatable="yes">Show _All</property>
+                    <property name="label" translatable="yes" comments="Filter By Dialog, Date Tab">Show _All</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -330,7 +330,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Start:</property>
+                        <property name="label" translatable="yes" comments="Filter By Dialog, Date Tab, Start section">Start:</property>
                       </object>
                       <packing>
                         <property name="x_options">GTK_FILL</property>
@@ -436,7 +436,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">End:</property>
+                        <property name="label" translatable="yes" comments="Filter By Dialog, Date Tab, End section">End:</property>
                       </object>
                       <packing>
                         <property name="top_attach">4</property>
@@ -581,7 +581,7 @@
                     <property name="n_columns">3</property>
                     <child>
                       <object class="GtkCheckButton" id="filter_status_unreconciled">
-                        <property name="label" translatable="yes">_Unreconciled</property>
+                        <property name="label" translatable="yes" comments="Filter By Dialog, State Tab">_Unreconciled</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -746,7 +746,7 @@
             <property name="can_focus">False</property>
             <child>
               <object class="GtkCheckButton" id="filter_save">
-                <property name="label" translatable="yes">Sa_ve Filter</property>
+                <property name="label" translatable="yes" comments="Filter By Dialog, below tabs">Sa_ve Filter</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -782,7 +782,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
-    <property name="title" translatable="yes">Sort register by...</property>
+    <property name="title" translatable="yes" comments="Sort register by Dialog">Sort register by...</property>
     <property name="resizable">False</property>
     <property name="window_position">center-on-parent</property>
     <property name="type_hint">dialog</property>
@@ -1092,12 +1092,13 @@
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="sort_reverse">
-                    <property name="label" translatable="yes">Reverse Order</property>
+                    <property name="label" translatable="yes">_Reverse Order</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="tooltip_text" translatable="yes">Sort in descending order.</property>
                     <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                     <signal name="toggled" handler="gnc_plugin_page_register_sort_order_reverse_cb" swapped="no"/>
diff --git a/src/import-export/dialog-import.glade b/src/import-export/dialog-import.glade
index 19c6be3..2e321af 100644
--- a/src/import-export/dialog-import.glade
+++ b/src/import-export/dialog-import.glade
@@ -343,7 +343,7 @@
         </child>
         <child>
           <object class="GtkCheckButton" id="pref/dialogs.import.generic/enable-skip">
-            <property name="label" translatable="yes">Enable skip transaction action</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Enable skip transaction action</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -364,7 +364,7 @@
         </child>
         <child>
           <object class="GtkCheckButton" id="pref/dialogs.import.generic/enable-update">
-            <property name="label" translatable="yes">Enable update match action</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Enable update match action</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -511,7 +511,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Commercial ATM _fees threshold</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Commercial ATM _fees threshold</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">pref/dialogs.import.generic/atm-fee-threshold</property>
           </object>
@@ -528,7 +528,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Auto-c_lear threshold</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Auto-c_lear threshold</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">pref/dialogs.import.generic/auto-clear-threshold</property>
           </object>
@@ -545,7 +545,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Auto-_add threshold</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Auto-_add threshold</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">pref/dialogs.import.generic/auto-add-threshold</property>
           </object>
@@ -562,7 +562,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Match _display threshold</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Match _display threshold</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">pref/dialogs.import.generic/match-threshold</property>
           </object>
@@ -576,7 +576,7 @@
         </child>
         <child>
           <object class="GtkCheckButton" id="pref/dialogs.import.generic/use-bayes">
-            <property name="label" translatable="yes">Use _bayesian matching</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Use _bayesian matching</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -597,7 +597,7 @@
         </child>
         <child>
           <object class="GtkCheckButton" id="pref/dialogs.import.generic/auto-create-commodity">
-            <property name="label" translatable="yes">Automatically create new commodities</property>
+            <property name="label" translatable="yes" comments="Preferences->Online Banking:Generic">Automatically create new commodities</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -634,7 +634,7 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkCheckButton" id="hide_reconciled_check1">
-                <property name="label" translatable="yes">Show Reconciled</property>
+                <property name="label" translatable="yes" comments="Dialog Select matching transactions">Show Reconciled</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -695,7 +695,7 @@
                 <property name="can_focus">False</property>
                 <property name="xpad">5</property>
                 <property name="ypad">5</property>
-                <property name="label" translatable="yes">Imported transaction's first split:</property>
+                <property name="label" translatable="yes" comments="Dialog Select matching transactions">Imported transaction's first split:</property>
                 <property name="justify">center</property>
               </object>
               <packing>
@@ -731,7 +731,7 @@
                 <property name="can_focus">False</property>
                 <property name="xpad">5</property>
                 <property name="ypad">5</property>
-                <property name="label" translatable="yes">Potential splits matching the selected transaction: </property>
+                <property name="label" translatable="yes" comments="Dialog Select matching transactions">Potential splits matching the selected transaction: </property>
                 <property name="justify">center</property>
               </object>
               <packing>

commit 90bbeac0788ec0e8b6f751d04ccb77de2da3e01a
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 20:20:20 2017 +0200

    Add a bunch of translator comments to C files

diff --git a/src/gnome-search/dialog-search.c b/src/gnome-search/dialog-search.c
index b48e477..93e22eb 100644
--- a/src/gnome-search/dialog-search.c
+++ b/src/gnome-search/dialog-search.c
@@ -1093,6 +1093,7 @@ type_label_to_new_button(const gchar* type_label)
     else
     {
         PWARN("No translatable new-button label found for search type \"%s\", please add one into dialog-search.c!", type_label);
+        /* Translators: This string has a disambiguation prefix. Translate only the part behind '|' */
         return Q_("Item represents an unknown object type (in the sense of bill, customer, invoice, transaction, split,...)|New item");
     }
 }
diff --git a/src/gnome-utils/gnc-tree-control-split-reg.c b/src/gnome-utils/gnc-tree-control-split-reg.c
index 1f07608..2fdca9d 100644
--- a/src/gnome-utils/gnc-tree-control-split-reg.c
+++ b/src/gnome-utils/gnc-tree-control-split-reg.c
@@ -1737,6 +1737,7 @@ gnc_tree_control_split_reg_save (GncTreeViewSplitReg *view, gboolean reg_closing
                 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                         "%s", message);
                 gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              /* Translators: Return to the transaction to update */
                               _("_Return"), GTK_RESPONSE_ACCEPT);
 
                 gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c
index 0585617..c3fe832 100644
--- a/src/gnome/gnc-plugin-page-register.c
+++ b/src/gnome/gnc-plugin-page-register.c
@@ -384,7 +384,9 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
         G_CALLBACK (gnc_plugin_page_register_cmd_schedule)
     },
     {
-        "ScrubAllAction", NULL, N_("_All transactions"), NULL, NULL,
+        "ScrubAllAction", NULL,
+		/* Translators: The following 2 are Scrub actions in register view */
+		N_("_All transactions"), NULL, NULL,
         G_CALLBACK (gnc_plugin_page_register_cmd_scrub_all)
     },
     {
diff --git a/src/gnome/gnc-split-reg.c b/src/gnome/gnc-split-reg.c
index a96f4e1..31a6802 100644
--- a/src/gnome/gnc-split-reg.c
+++ b/src/gnome/gnc-split-reg.c
@@ -982,7 +982,9 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
 
     gtk_dialog_add_button(GTK_DIALOG(dialog),
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
+    gnc_gtk_dialog_add_button(dialog,
+                              /* Translators: This is the confirmation button in a warning dialog */
+                               _("_Remove Splits"),
                               GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
     response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
     gtk_widget_destroy (dialog);
diff --git a/src/import-export/csv-exp/csv-transactions-export.c b/src/import-export/csv-exp/csv-transactions-export.c
index bced322..f9e9fa2 100644
--- a/src/import-export/csv-exp/csv-transactions-export.c
+++ b/src/import-export/csv-exp/csv-transactions-export.c
@@ -414,15 +414,25 @@ void csv_transactions_export (CsvExportInfo *info)
         }
 
         /* Header string */
-        header = g_strconcat (end_sep, _("Date"), mid_sep, _("Account Name"), mid_sep,
+        header = g_strconcat (end_sep,
+				               /* Translators: The following symbols will build the *
+				                * header line of exported CSV files:                */
+                               _("Date"), mid_sep, _("Account Name"), mid_sep,
                                (num_action ? _("Transaction Number") : _("Number")),
                                mid_sep, _("Description"), mid_sep, _("Notes"),
                                mid_sep, _("Memo"), mid_sep, _("Category"), mid_sep,
                                _("Type"), mid_sep,
                                (num_action ? _("Number/Action") : _("Action")),
                                mid_sep, _("Reconcile"), mid_sep,
-                               _("To With Sym"), mid_sep, _("From With Sym"), mid_sep,
-                               _("To Num."), mid_sep, _("From Num."), mid_sep,
+							   /* Translators: To amount with currency symbol */
+                               _("To With Sym"), mid_sep,
+							   /* Translators: From amount with currency symbol */
+							   _("From With Sym"), mid_sep,
+							   /* Translators: To amount, numerical only */
+                               _("To Num."), mid_sep,
+							   /* Translators: From amount, numerical only */
+							   _("From Num."), mid_sep,
+							   /* Translators: Exchange rates */
                                _("To Rate/Price"), mid_sep, _("From Rate/Price"),
                                end_sep, EOLSTR, NULL);
         DEBUG("Header String: %s", header);
diff --git a/src/register/ledger-core/split-register-layout.c b/src/register/ledger-core/split-register-layout.c
index ca77059..22571f8 100644
--- a/src/register/ledger-core/split-register-layout.c
+++ b/src/register/ledger-core/split-register-layout.c
@@ -634,6 +634,11 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
     gnc_register_add_cell (layout,
                            DATE_CELL,
                            DATE_CELL_TYPE_NAME,
+                           /* Translators: The 'sample:' items are
+                              strings which are not displayed, but only
+                              used to estimate widths. Please only
+                              translate the portion after the ':' and
+                              leave the rest ("sample:") as is. */
                            N_("sample:12/12/2000") + 7,
                            CELL_ALIGN_RIGHT,
                            FALSE,
@@ -687,7 +692,11 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
     gnc_register_add_cell (layout,
                            RECN_CELL,
                            RECN_CELL_TYPE_NAME,
-                           N_("Reconciled:R") + 11,
+	                          /* Translators: The abbreviation for 'Reconciled'
+	                              in the header row of the register. Please only
+	                              translate the portion after the ':' and
+	                              leave the rest ("Reconciled:") as is. */
+	                            N_("Reconciled:R") + 11,
                            CELL_ALIGN_CENTER,
                            FALSE,
                            FALSE);
@@ -695,6 +704,10 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
     gnc_register_add_cell (layout,
                            ASSOC_CELL,
                            RECN_CELL_TYPE_NAME,
+                           /* Translators: The abbreviation for 'Associate'
+                              in the header row of the register. Please only
+                              translate the portion after the ':' and
+                              leave the rest ("Associate:") as is. */
                            N_("Associate:A") + 10,
                            CELL_ALIGN_CENTER,
                            FALSE,
@@ -809,7 +822,11 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
     gnc_register_add_cell (layout,
                            TYPE_CELL,
                            RECN_CELL_TYPE_NAME,
-                           N_("Type:T") + 5,
+	                          /* Translators: The abbreviation for 'Type'
+	                              in the header row of the register. Please only
+	                              translate the portion after the ':' and
+	                              leave the rest ("Type:") as is. */
+	                            N_("Type:T") + 5,
                            CELL_ALIGN_CENTER,
                            FALSE,
                            FALSE);

commit 97c3483e06b1d6380905b8b42d491c67f8fabee7
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 20:19:10 2017 +0200

    Improve type of bank accounts in SKR03

diff --git a/accounts/de_DE/acctchrt_skr03.gnucash-xea b/accounts/de_DE/acctchrt_skr03.gnucash-xea
index b2062a1..7573ab9 100644
--- a/accounts/de_DE/acctchrt_skr03.gnucash-xea
+++ b/accounts/de_DE/acctchrt_skr03.gnucash-xea
@@ -202,7 +202,7 @@
   <gnc:account version="2.0.0">
     <act:name>1100 Postbank</act:name>
     <act:id type="new">9fe8d61dac9cf62b3f12e6c71a4385b2</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>BANK</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -214,7 +214,7 @@
   <gnc:account version="2.0.0">
     <act:name>1200 Bankkonto</act:name>
     <act:id type="new">875ec51cd332f3b75c15a2a9ca309ebd</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>BANK</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>

commit c71bfe8d6b6bb673a41e6c30b68ba53fe4573c29
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 19:44:10 2017 +0200

    Add "Assets & Liabilities", "Profit & Loss" to the glossary,
    
    fix a typo and update all glossary po files

diff --git a/po/glossary/ar.po b/po/glossary/ar.po
index 4df9955..d81960f 100644
--- a/po/glossary/ar.po
+++ b/po/glossary/ar.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: GnuCash 2.6.8\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: \n"
 "Last-Translator: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>\n"
 "Language-Team: None\n"
@@ -42,6 +42,10 @@ msgstr ""
 msgid "account type: Asset"
 msgstr ""
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+msgid "account type: Assets & Liabilities"
+msgstr ""
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr ""
@@ -78,6 +82,10 @@ msgstr ""
 msgid "account type: Passive"
 msgstr ""
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+msgid "account type: Profit & Loss"
+msgstr ""
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr ""
@@ -150,7 +158,7 @@ msgstr ""
 msgid "action: payment"
 msgstr ""
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr ""
 
@@ -390,7 +398,7 @@ msgstr ""
 msgid "gain"
 msgstr ""
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr ""
 
@@ -410,10 +418,6 @@ msgstr ""
 msgid "invoice"
 msgstr ""
 
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr ""
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr ""
@@ -514,6 +518,10 @@ msgstr ""
 msgid "orphan"
 msgstr ""
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr ""
@@ -686,7 +694,7 @@ msgstr ""
 msgid "subtotal"
 msgstr ""
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 msgid "tax code"
 msgstr ""
 
diff --git a/po/glossary/bg.po b/po/glossary/bg.po
index 27beb17..e089bd4 100644
--- a/po/glossary/bg.po
+++ b/po/glossary/bg.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnucash 2.2.5\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2011-10-25 13:18+0200\n"
 "Last-Translator: Rosi Dimova <pocu at bk.ru>\n"
 "Language-Team: BG <bg at li.org>\n"
@@ -48,6 +48,11 @@ msgstr "account type: Актив"
 msgid "account type: Asset"
 msgstr "account type: Актив"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "account type: Пасив"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "account type: разплащателна сметка"
@@ -85,6 +90,11 @@ msgstr "account type: взаимни фондове"
 msgid "account type: Passive"
 msgstr "account type: Актив"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "account type: Актив"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "account type: спестовна сметка"
@@ -158,7 +168,7 @@ msgstr "action: заем"
 msgid "action: payment"
 msgstr "action: плащане"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "action: ПОС-терминал"
 
@@ -403,7 +413,7 @@ msgid "gain"
 msgstr "печалба"
 
 # Ausgleichskonto
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "неравнена сметка"
 
@@ -424,11 +434,6 @@ msgstr "лихва"
 msgid "invoice"
 msgstr "фактура на клиент"
 
-# (издадена фактура)
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr "получател на фактура"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "задание"
@@ -530,6 +535,10 @@ msgstr "поръчка"
 msgid "orphan"
 msgstr "изоставен"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "парола"
@@ -705,7 +714,7 @@ msgstr "таблица със стил"
 msgid "subtotal"
 msgstr "междинна сума"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 msgid "tax code"
 msgstr "данъчен код"
 
@@ -793,3 +802,7 @@ msgstr "ваучер"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "задължавам, дебитирам"
+
+# (издадена фактура)
+#~ msgid "invoice owner"
+#~ msgstr "получател на фактура"
diff --git a/po/glossary/ca.po b/po/glossary/ca.po
index b931def..ec640db 100644
--- a/po/glossary/ca.po
+++ b/po/glossary/ca.po
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 2.2\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2008-08-03 16:43+0200\n"
 "Last-Translator: David Planella Molas <david.planella at gmail.com>\n"
 "Language-Team: Catalan <ca at li.org>\n"
@@ -44,6 +44,11 @@ msgstr "Actiu"
 msgid "account type: Asset"
 msgstr "Actiu"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Passiu"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "compte corrent"
@@ -81,6 +86,11 @@ msgstr "Fons d'inversió"
 msgid "account type: Passive"
 msgstr "Actiu"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Actiu"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "compte d'estalvis"
@@ -154,7 +164,7 @@ msgstr "préstec"
 msgid "action: payment"
 msgstr "pagament"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "terminal punt de venda"
 
@@ -399,7 +409,7 @@ msgstr "pagaments"
 msgid "gain"
 msgstr "guany, benefici"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "desquadrament"
 
@@ -420,12 +430,6 @@ msgstr "interès"
 msgid "invoice"
 msgstr "factura"
 
-# En català generalment no es diferencia entre bill («abonaré») i invoice («pagaré»), per la qual cosa s'utilitzarà «factura» per a ambdós termes (dpm).
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "factura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "tasca"
@@ -527,6 +531,10 @@ msgstr "comanda"
 msgid "orphan"
 msgstr "orfe"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "contrasenya"
@@ -701,7 +709,7 @@ msgstr "full d'estil"
 msgid "subtotal"
 msgstr "subtotal"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "informació d'impostos"
@@ -789,3 +797,8 @@ msgstr "justificant de despesa"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "càrrec"
+
+# En català generalment no es diferencia entre bill («abonaré») i invoice («pagaré»), per la qual cosa s'utilitzarà «factura» per a ambdós termes (dpm).
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "factura"
diff --git a/po/glossary/da.po b/po/glossary/da.po
index 23588e4..7c25424 100644
--- a/po/glossary/da.po
+++ b/po/glossary/da.po
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 2.3.5\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2009-09-04 22:41+0200\n"
 "Last-Translator: Joe Hansen <joedalton2 at yahoo.dk>\n"
 "Language-Team: Danish <dansk at dansk-gruppen.dk>\n"
@@ -45,6 +45,11 @@ msgstr "kontotype: Aktiv"
 msgid "account type: Asset"
 msgstr "kontotype: Aktiv"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "kontotype: Gæld"
+
 # src/prefs.c:210
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
@@ -83,6 +88,11 @@ msgstr "kontotype: aktiefond"
 msgid "account type: Passive"
 msgstr "kontotype: Aktiv"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "kontotype: Aktiv"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "kontotype: opsparing"
@@ -156,7 +166,7 @@ msgstr "hændelse: lån"
 msgid "action: payment"
 msgstr "hændelse: betaling"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "hændelse: kasseapparat"
 
@@ -400,7 +410,7 @@ msgstr "finansiel lommeregner: betalinger"
 msgid "gain"
 msgstr "gevinst"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "ubalance"
 
@@ -420,11 +430,6 @@ msgstr "rente"
 msgid "invoice"
 msgstr "faktura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "faktura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "opgave"
@@ -528,6 +533,10 @@ msgstr "ordre"
 msgid "orphan"
 msgstr "forældreløs"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "adgangsfrase"
@@ -704,7 +713,7 @@ msgstr "stilark"
 msgid "subtotal"
 msgstr "delsum"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "skatteinformation"
@@ -796,5 +805,9 @@ msgstr "kilde"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "hævning (i afstemningsdialogen)"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "faktura"
+
 #~ msgid "Term"
 #~ msgstr "Term"
diff --git a/po/glossary/de.po b/po/glossary/de.po
index 9e192e1..ad9daf8 100644
--- a/po/glossary/de.po
+++ b/po/glossary/de.po
@@ -2,12 +2,12 @@
 # Copyright (C) 2001 Free Software Foundation, Inc.
 #
 # Christian Stimming <stimming at tuhh.de>, 2001 - 2013.
-# Frank H. Ellenberger <frank.h.ellenberger at gmail.com>, 2013, 2014.
+# Frank H. Ellenberger <frank.h.ellenberger at gmail.com>, 2013 - 2017.
 msgid ""
 msgstr ""
-"Project-Id-Version: gnucash 2.5\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
-"PO-Revision-Date: 2014-10-13 00:45+0200\n"
+"Project-Id-Version: gnucash 2.6.18\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
+"PO-Revision-Date: 2017-10-20 18:25+0200\n"
 "Last-Translator: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>\n"
 "Language-Team: German <gnucash-de at gnucash.org>\n"
 "Language: German\n"
@@ -45,6 +45,10 @@ msgstr "Aktiva"
 msgid "account type: Asset"
 msgstr "Aktiva"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+msgid "account type: Assets & Liabilities"
+msgstr "Aktiva & Passiva; Bilanz- oder Bestandskonten"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "Girokonto"
@@ -81,6 +85,10 @@ msgstr "Investmentfonds"
 msgid "account type: Passive"
 msgstr "Passiva"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+msgid "account type: Profit & Loss"
+msgstr "GuV; Gewinn- & Verlustkonten; Erfolgskonten"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "Sparkonto"
@@ -153,7 +161,7 @@ msgstr "Darlehen"
 msgid "action: payment"
 msgstr "Zahlung"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "Karten-Terminal"
 
@@ -397,7 +405,7 @@ msgstr "Raten"
 msgid "gain"
 msgstr "Wertzuwachs (Gewinn, Zunahme, Profit, Ertrag)"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "Ausgleichskonto"
 
@@ -417,10 +425,6 @@ msgstr "Zinsen"
 msgid "invoice"
 msgstr "Rechnung (Rechnungsausgang, Versandte Rechnung)"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr "Kunde, Rechnungsempfänger"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "Auftrag"
@@ -521,6 +525,10 @@ msgstr "Bestellung"
 msgid "orphan"
 msgstr "Ausbuchungskonto??"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "Passwort (Mantra, Passphrase)"
@@ -698,7 +706,7 @@ msgstr "Stilvorlage"
 msgid "subtotal"
 msgstr "Zwischensumme"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 msgid "tax code"
 msgstr "Steuerschlüssel, Steuerformularfeldnummer"
 
@@ -785,3 +793,6 @@ msgstr "Auslagenerstattung"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "Belastung"
+
+#~ msgid "invoice owner"
+#~ msgstr "Kunde, Rechnungsempfänger"
diff --git a/po/glossary/de_CH.po b/po/glossary/de_CH.po
index e52053f..ee09aa3 100644
--- a/po/glossary/de_CH.po
+++ b/po/glossary/de_CH.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash 1.7\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2008-03-03 00:47+0100\n"
 "Last-Translator: Raffael Luthiger <r.luthiger at huanga.com>\n"
 "Language-Team: DE\n"
@@ -43,6 +43,11 @@ msgstr "Aktiven"
 msgid "account type: Asset"
 msgstr "Aktiven"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Passiven"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "Girokonto"
@@ -80,6 +85,11 @@ msgstr "Investmentfonds"
 msgid "account type: Passive"
 msgstr "Aktiven"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Aktiven"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "Sparkonto"
@@ -153,7 +163,7 @@ msgstr "Darlehen"
 msgid "action: payment"
 msgstr "Zahlung"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "Kassensystem"
 
@@ -400,7 +410,7 @@ msgstr "Raten"
 msgid "gain"
 msgstr "Wertzuwachs (Gewinn, Zunahme, Profit, Ertrag)"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "Ausgleichskonto"
 
@@ -420,11 +430,6 @@ msgstr "Zinsen"
 msgid "invoice"
 msgstr "Rechnung (Rechnungsausgang, Versandte Rechnung)"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "Rechnung (Rechnungsausgang, Versandte Rechnung)"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "Auftrag"
@@ -526,6 +531,10 @@ msgstr "Bestellung"
 msgid "orphan"
 msgstr "Ausbuchungskonto??"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "Passwort (Mantra, Passphrase)"
@@ -701,7 +710,7 @@ msgstr "Stilvorlage"
 msgid "subtotal"
 msgstr "Zwischensumme"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "Steuerrelevante Informationen"
@@ -789,3 +798,7 @@ msgstr "Auslagenerstattung"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "Belastung"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "Rechnung (Rechnungsausgang, Versandte Rechnung)"
diff --git a/po/glossary/el.po b/po/glossary/el.po
index efd4f70..c82a3e5 100644
--- a/po/glossary/el.po
+++ b/po/glossary/el.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 1.0\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2001-12-28 00:17+0000\n"
 "Last-Translator: Simos Xenitellis <simos at hellug.gr>\n"
 "Language-Team: Greek <nls at tux.hellug.gr>\n"
@@ -47,6 +47,11 @@ msgstr "
 msgid "account type: Asset"
 msgstr "Åßäïò Ðáñáóêçíßïõ:"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Åßäïò Ðáñáóêçíßïõ:"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr ""
@@ -84,6 +89,11 @@ msgstr ""
 msgid "account type: Passive"
 msgstr "Åßäïò Ðáñáóêçíßïõ:"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Åßäïò Ðáñáóêçíßïõ:"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr ""
@@ -171,7 +181,7 @@ msgstr "
 msgid "action: payment"
 msgstr "Ï_íüìáôá ÓõíáñôÞóåùí"
 
-#. "-"
+#. "Point of sale"
 #, fuzzy
 msgid "action: POS"
 msgstr "Ôïðïèåóßá: "
@@ -454,7 +464,7 @@ msgstr ""
 msgid "gain"
 msgstr "Âñï÷Þ"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 #, fuzzy
 msgid "imbalance"
 msgstr "Éóïññïðßá"
@@ -479,11 +489,6 @@ msgstr "
 msgid "invoice"
 msgstr "áñ÷Üñéïò"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "áñ÷Üñéïò"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr ""
@@ -609,6 +614,10 @@ msgstr ""
 msgid "orphan"
 msgstr "ÊïñåÜôéêá"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr ""
@@ -813,7 +822,7 @@ msgstr "
 msgid "subtotal"
 msgstr "%d óõíïëéêÜ"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "ðëçñïöïñßåò çëåê. äéåýè."
@@ -922,5 +931,9 @@ msgstr "
 msgid "withdraw (in the reconcile dialog)"
 msgstr ""
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "áñ÷Üñéïò"
+
 #~ msgid "Term"
 #~ msgstr "Ïñéóìüò"
diff --git a/po/glossary/es.po b/po/glossary/es.po
index 81900eb..a006701 100644
--- a/po/glossary/es.po
+++ b/po/glossary/es.po
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 1.8.9\n"
 "Report-Msgid-Bugs-To: Eneko Lacunza <enlar at enlar.net>\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2004-11-23 22:19+0100\n"
 "Last-Translator: Eneko Lacunza <enlar at enlar.net>\n"
 "Language-Team: Spanish <es at li.org>\n"
@@ -47,6 +47,11 @@ msgstr "tipo de cuenta: Activo"
 msgid "account type: Asset"
 msgstr "tipo de cuenta: Activo"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "tipo de cuenta: Pasivo"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "tipo de cuenta: cuenta corriente"
@@ -84,6 +89,11 @@ msgstr "tipo de cuenta: Fondo de Inversi
 msgid "account type: Passive"
 msgstr "tipo de cuenta: Activo"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "tipo de cuenta: Activo"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "tipo de cuenta: cuenta de ahorro"
@@ -157,7 +167,7 @@ msgstr "acci
 msgid "action: payment"
 msgstr "acción: pago"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "acción: POS"
 
@@ -401,7 +411,7 @@ msgstr "calculadora financiera: pagos"
 msgid "gain"
 msgstr "ganancia, beneficio"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "descuadre"
 
@@ -421,11 +431,6 @@ msgstr "inter
 msgid "invoice"
 msgstr "factura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "factura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "trabajo/tarea"
@@ -529,6 +534,10 @@ msgstr "pedido"
 msgid "orphan"
 msgstr "huérfano"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "clave de acceso"
@@ -704,7 +713,7 @@ msgstr "hoja de estilo"
 msgid "subtotal"
 msgstr "subtotal"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "información sobre impuestos"
@@ -795,5 +804,9 @@ msgstr "fuente"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "cargo"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "factura"
+
 #~ msgid "Term"
 #~ msgstr "Condiciones (Términos) (de pago)"
diff --git a/po/glossary/fr.po b/po/glossary/fr.po
index c101c1d..527dbe9 100644
--- a/po/glossary/fr.po
+++ b/po/glossary/fr.po
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash 2.0\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2013-12-25 13:16+0100\n"
 "Last-Translator: Sébastien Villemot <sebastien at debian.org>\n"
 "Language-Team: FR\n"
@@ -46,6 +46,11 @@ msgstr "type de compte : actif"
 msgid "account type: Asset"
 msgstr "type de compte : actif"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "type de compte : passif"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "type de compte : compte courant"
@@ -83,6 +88,11 @@ msgstr "type de compte : fond mutuel"
 msgid "account type: Passive"
 msgstr "type de compte : actif"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "type de compte : actif"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "type de compte : épargne"
@@ -155,7 +165,7 @@ msgstr "action : emprunt"
 msgid "action: payment"
 msgstr "action : paiement"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "action : POS"
 
@@ -395,7 +405,7 @@ msgstr "calcul financier : paiements"
 msgid "gain"
 msgstr "profit"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "non soldé"
 
@@ -415,10 +425,6 @@ msgstr "intérêt"
 msgid "invoice"
 msgstr "facture"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr "destinataire de la facture"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "tâche"
@@ -519,6 +525,10 @@ msgstr "rang"
 msgid "orphan"
 msgstr "orphelin"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "mot de code"
@@ -691,7 +701,7 @@ msgstr "feuille de style"
 msgid "subtotal"
 msgstr "sous-total"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 msgid "tax code"
 msgstr "code de taxe"
 
@@ -778,3 +788,6 @@ msgstr "bon (commande)"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "retrait (dans le dialogue de rapprochement)"
+
+#~ msgid "invoice owner"
+#~ msgstr "destinataire de la facture"
diff --git a/po/glossary/gnc-glossary.txt b/po/glossary/gnc-glossary.txt
index 56449a0..7d7c79f 100644
--- a/po/glossary/gnc-glossary.txt
+++ b/po/glossary/gnc-glossary.txt
@@ -5,6 +5,7 @@
 "account name"	"-"
 "account type: Active"	"The left side of the balance sheet in T account form shows the application of funds in form of assets. Because it contains only assets use assets directly. Complement: Passive. See also: Report Form"
 "account type: Asset"	"A thing, esp. owned by a person or company, that has value and can be used or sold to pay debts. Dependent on the context you might use 'account type: Active' instead."
+"account type: Assets & Liabilities"	"in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
 "account type: checking"	"(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 "account type: currency"	"-"
 "account type: Equity"	"see: Equity, but see also 'account type: Passive'"
@@ -14,6 +15,7 @@
 "account type: money-market"	"-"
 "account type: Mutual fund"	"-"
 "account type: Passive"	"The right side of the balance sheet in T account form shows the source of funds and contains equity & liability. While not common in english, most languages would translate 'equity & liability' with 'passive'. Complement: Active. See also: Report Form Implementation: https://bugzilla.gnome.org/show_bug.cgi?id=421766"
+"account type: Profit & Loss"	"Group of accounts tracking your success, complement of 'Assets & Liabilities'"
 "account type: saving"	"1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 "account type: Stock"	"-"
 "account type: trading"	"This account type (new in gnucash-2.4.0) is used when exchanging or trading amounts from one currency into another"
@@ -32,7 +34,7 @@
 "action: int"	"transaction comes from interest"
 "action: loan"	"-"
 "action: payment"	"see: payment 1."
-"action: POS"	"-"
+"action: POS"	"Point of sale"
 "action: rebate"	"-"
 "action: sell"	"-"
 "action: Teller"	"-"
@@ -97,7 +99,6 @@
 "income statement"	"Report that ... FIXME: add description. This report used to be called the 'Profit & Loss', but it was renamed on 2004-07-13."
 "interest"	"Money charged for borrowing money, or paid to somebody who invests money"
 "invoice"	"A list of goods sold or services provided together with the prices charged; see also: a bill. In Gnucash, an 'invoice' is a statement that we sent out (to a customer), whereas a 'bill' is one that we received (from a vendor)."
-"invoice owner"	"The customer (or vendor) to which this invoice is sent to."
 "job"	"In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 "ledger"	"A book in which a bank, business firm, etc. records its financial accounts"
 "liabilities/equity"	"The heading for the right side of the balance sheet. See also: Equity."
@@ -123,6 +124,7 @@
 "options"	"A menu choice in the graphical user interface that allows the user to specify how the application will act each time it is used. "
 "order"	"Watch out: Although this word exists in gnucash program code, all that program code in gnucash is currently not activated. In the future, it will be used in business accounting as follows: A particular request to make or supply goods, but belonging to a (larger) job. Such a request can come from a customer or be sent to a vendor. An order will probably generate one invoice or bill."
 "orphan"	"Name of an automatically created account that holds splits that have no account."
+"owner (of bill, invoice or expense voucher)"	"The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
 "passphrase"	"A secret phrase that one needs to know in order to get access to a user account "
 "Payables/Receivables"	"An amount that must be paid / An amount for which money has not yet been received"
 "payee"	"A person to whom sth is paid"
diff --git a/po/glossary/he.po b/po/glossary/he.po
index 0065e62..baa3087 100644
--- a/po/glossary/he.po
+++ b/po/glossary/he.po
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash 2.2\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2008-04-23 00:04+0200\n"
 "Last-Translator: Ori Hoch <ori at uumpa.com>\n"
 "Language-Team: HE\n"
@@ -44,6 +44,11 @@ msgstr "נכס"
 msgid "account type: Asset"
 msgstr "נכס"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "חוב"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "עובר ושב"
@@ -81,6 +86,11 @@ msgstr "קרן נאמנות"
 msgid "account type: Passive"
 msgstr "נכס"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "נכס"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "חיסכון"
@@ -154,7 +164,7 @@ msgstr "הלוואה"
 msgid "action: payment"
 msgstr "תשלום"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "נקודת מכירה"
 
@@ -401,7 +411,7 @@ msgstr "מקש קיצור למחשבון"
 msgid "gain"
 msgstr "רווח"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr ""
 
@@ -422,11 +432,6 @@ msgstr "ריבית"
 msgid "invoice"
 msgstr "קבלה"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "קבלה"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 #, fuzzy
 msgid "job"
@@ -534,6 +539,10 @@ msgstr "סדר"
 msgid "orphan"
 msgstr ""
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "סיסמה"
@@ -729,7 +738,7 @@ msgstr "גיליון מסוגנן"
 msgid "subtotal"
 msgstr ""
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "מידע על הפרויקט"
@@ -829,3 +838,7 @@ msgstr ""
 #, fuzzy
 msgid "withdraw (in the reconcile dialog)"
 msgstr "חלק מההגדרות בתיבת הדו-שיח מתנגשים"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "קבלה"
diff --git a/po/glossary/hu.po b/po/glossary/hu.po
index f6c4547..723d825 100644
--- a/po/glossary/hu.po
+++ b/po/glossary/hu.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: @gnucash@\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2007-07-31 22:59+0200\n"
 "Last-Translator: Kornel Tako <takokornel at gmail.com>\n"
 "Language-Team: Hungarian <gnucash-devel-request at gnucash.org>\n"
@@ -46,6 +46,11 @@ msgstr "Számla típus:Eszköz"
 msgid "account type: Asset"
 msgstr "Számla típus:Eszköz"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Számla típus: Kötelezettség"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "Számla típus: Folyószámla"
@@ -83,6 +88,11 @@ msgstr "Számla típus: Befektetési alap"
 msgid "account type: Passive"
 msgstr "Számla típus:Eszköz"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Számla típus:Eszköz"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "Számla típus: Megtakarítás"
@@ -156,7 +166,7 @@ msgstr "Végrehajtás: hitel"
 msgid "action: payment"
 msgstr "Végrehajtás: kifizetés"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "Végrhajtás: POS"
 
@@ -400,7 +410,7 @@ msgstr "Pénzügyi számológép: Kifizetés"
 msgid "gain"
 msgstr "Nyereség"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "Hiányszámla"
 
@@ -420,11 +430,6 @@ msgstr "Kamat"
 msgid "invoice"
 msgstr "Számla"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "Számla"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "Megbízás"
@@ -526,6 +531,10 @@ msgstr "Megbízás"
 msgid "orphan"
 msgstr "Árva"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "Jelszó"
@@ -701,7 +710,7 @@ msgstr "Oldal stílus"
 msgid "subtotal"
 msgstr "részösszeg "
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "adó info"
@@ -789,3 +798,7 @@ msgstr "Nyugta"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "kivét"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "Számla"
diff --git a/po/glossary/it.po b/po/glossary/it.po
index 36950ec..9a524d5 100644
--- a/po/glossary/it.po
+++ b/po/glossary/it.po
@@ -12,7 +12,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 1.7.4\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2004-01-31 15:33+0100\n"
 "Last-Translator: Lorenzo Cappelletti <lorenzo.cappelletti at email.it>\n"
 "Language-Team: Italian <tp at lists.linux.it>\n"
@@ -50,6 +50,11 @@ msgstr "tipo conto: attivo, attivit
 msgid "account type: Asset"
 msgstr "tipo conto: attivo, attività"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "tipo conto: passivo, passività, obbligazione, debito"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "tipo conto: conto corrente"
@@ -87,6 +92,11 @@ msgstr "tipo conto: fondi comuni"
 msgid "account type: Passive"
 msgstr "tipo conto: attivo, attività"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "tipo conto: attivo, attività"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "tipo conto: di risparmio"
@@ -161,7 +171,7 @@ msgstr "operazione: mutuo, prestito"
 msgid "action: payment"
 msgstr "operazione: pagamento"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "operazione: POS"
 
@@ -407,7 +417,7 @@ msgstr "calcolatrice finanziaria: pagamenti"
 msgid "gain"
 msgstr "guadagno"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "sbilancio"
 
@@ -427,11 +437,6 @@ msgstr "interesse"
 msgid "invoice"
 msgstr "fattura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "fattura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "lavoro, compito"
@@ -535,6 +540,10 @@ msgstr "ordine"
 msgid "orphan"
 msgstr "orfano"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "frase segreta"
@@ -711,7 +720,7 @@ msgstr "foglio di stile"
 msgid "subtotal"
 msgstr "subtotale"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "info imposte"
@@ -802,5 +811,9 @@ msgstr "buono, nota, garante"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "prelievo (in una finestra di riconciliazione)"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "fattura"
+
 #~ msgid "Term"
 #~ msgstr "Termine"
diff --git a/po/glossary/lt.po b/po/glossary/lt.po
index 07de7f1..28b9c9f 100644
--- a/po/glossary/lt.po
+++ b/po/glossary/lt.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: lt\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2011-08-28 20:55+0300\n"
 "Last-Translator: Aurimas Fišeras <aurimas at members.fsf.org>\n"
 "Language-Team: komp_lt at konf.lt\n"
@@ -47,6 +47,11 @@ msgstr "sÄ…skaitos tipas: Turtas"
 msgid "account type: Asset"
 msgstr "sÄ…skaitos tipas: Turtas"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "sąskaitos tipas: Įsipareigojimas"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "sÄ…skaitos tipas: einamoji"
@@ -84,6 +89,11 @@ msgstr "sÄ…skaitos tipas: Investicinis fondas"
 msgid "account type: Passive"
 msgstr "sÄ…skaitos tipas: Turtas"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "sÄ…skaitos tipas: Turtas"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "sÄ…skaitos tipas: taupomoji"
@@ -156,7 +166,7 @@ msgstr "veiksmas: paskola"
 msgid "action: payment"
 msgstr "veiksmas: mokÄ—jimas"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "veiksmas: EKA"
 
@@ -398,7 +408,7 @@ msgstr "finansinis skaičiuotuvas: mokėjimas"
 msgid "gain"
 msgstr "pelnas"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "disbalansas"
 
@@ -418,10 +428,6 @@ msgstr "palūkanos"
 msgid "invoice"
 msgstr "sąskaita-faktūra"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr "sąskaitos-faktūros gavėjas"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "užduotis"
@@ -522,6 +528,10 @@ msgstr "užsakymas"
 msgid "orphan"
 msgstr "pamesta"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "slaptafrazÄ—"
@@ -695,7 +705,7 @@ msgstr "stiliaus aprašas"
 msgid "subtotal"
 msgstr "tarpinÄ— suma"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 msgid "tax code"
 msgstr "mokesčio kodas"
 
@@ -782,3 +792,6 @@ msgstr "kvitas"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "išėmimas (suderinimo lange)"
+
+#~ msgid "invoice owner"
+#~ msgstr "sąskaitos-faktūros gavėjas"
diff --git a/po/glossary/nb.po b/po/glossary/nb.po
index ab16f91..b1261c5 100644
--- a/po/glossary/nb.po
+++ b/po/glossary/nb.po
@@ -9,7 +9,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2005-12-19 15:48+0800\n"
 "Last-Translator: Tor Harald Thorland <tortho at strigen.com>\n"
 "Language-Team: Norwegian/Bokmaal <i18n-nb at lister.ping.uio.no>\n"
@@ -47,6 +47,11 @@ msgstr "account type: Aktiva"
 msgid "account type: Asset"
 msgstr "account type: Aktiva"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "account type: Gjeld"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr ""
@@ -84,6 +89,11 @@ msgstr ""
 msgid "account type: Passive"
 msgstr "account type: Aktiva"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "account type: Aktiva"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "account type: sparekonto"
@@ -157,7 +167,7 @@ msgstr ""
 msgid "action: payment"
 msgstr "action: betaling"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr ""
 
@@ -401,7 +411,7 @@ msgstr ""
 msgid "gain"
 msgstr "fortjeneste"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "ubalanse"
 
@@ -421,11 +431,6 @@ msgstr "rente"
 msgid "invoice"
 msgstr "faktura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "faktura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "jobb"
@@ -527,6 +532,10 @@ msgstr "ordre"
 msgid "orphan"
 msgstr ""
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "passord frase"
@@ -701,7 +710,7 @@ msgstr "stilmal"
 msgid "subtotal"
 msgstr "delsum"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "MVA Informasjon"
@@ -792,5 +801,9 @@ msgstr "kilde"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "uttak"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "faktura"
+
 #~ msgid "Term"
 #~ msgstr "Definisjon"
diff --git a/po/glossary/nl.po b/po/glossary/nl.po
index 43e419e..49a91ed 100644
--- a/po/glossary/nl.po
+++ b/po/glossary/nl.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: GNUCasg 1.9.4 svn\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2006-04-16 20:08+0200\n"
 "Last-Translator: Bernard Meens <meensb at xs4all.nl>\n"
 "Language-Team: NONE\n"
@@ -43,6 +43,11 @@ msgstr "Activa"
 msgid "account type: Asset"
 msgstr "Activa"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Passiva"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "rekening courant"
@@ -80,6 +85,11 @@ msgstr "Investeringsfonds"
 msgid "account type: Passive"
 msgstr "Activa"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Activa"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "Spaarrekening"
@@ -153,7 +163,7 @@ msgstr "lenen"
 msgid "action: payment"
 msgstr "betaling"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "betaalautomaat"
 
@@ -397,7 +407,7 @@ msgstr "betalingen"
 msgid "gain"
 msgstr "toename"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "ongebalanceerd"
 
@@ -417,11 +427,6 @@ msgstr "interest"
 msgid "invoice"
 msgstr "factuur"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "factuur"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "opdracht"
@@ -523,6 +528,10 @@ msgstr "opdracht"
 msgid "orphan"
 msgstr "wees"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "passphrase"
@@ -697,7 +706,7 @@ msgstr "stijlblad"
 msgid "subtotal"
 msgstr "subtotaal"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "belastinginfo"
@@ -785,3 +794,7 @@ msgstr "voucher"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "opname"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "factuur"
diff --git a/po/glossary/pl.po b/po/glossary/pl.po
index fd51985..3a45c0b 100644
--- a/po/glossary/pl.po
+++ b/po/glossary/pl.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: GnuCash 2.2.x\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2010-09-06 12:20+0200\n"
 "Last-Translator: Radzisław Galler <rgaller at gazeta.pl>\n"
 "Language-Team: Polish <translators at gnomepl.org>\n"
@@ -45,6 +45,11 @@ msgstr "typ konta: Aktywa"
 msgid "account type: Asset"
 msgstr "typ konta: Aktywa"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "typ konta: ZobowiÄ…zania"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "typ konta: A'vista"
@@ -82,6 +87,11 @@ msgstr "typ konta: Fundusz wzajemny"
 msgid "account type: Passive"
 msgstr "typ konta: Aktywa"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "typ konta: Aktywa"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "typ konta: oszczędności"
@@ -155,7 +165,7 @@ msgstr "akcja: pożyczka"
 msgid "action: payment"
 msgstr "akcja: płatność"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "akcja: punkt sprzedaży"
 
@@ -399,7 +409,7 @@ msgstr "kalkulator finansowy: płatności"
 msgid "gain"
 msgstr "zysk"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "niezrównoważenie"
 
@@ -419,11 +429,6 @@ msgstr "odsetki"
 msgid "invoice"
 msgstr "faktura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "faktura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "zlecenie"
@@ -525,6 +530,10 @@ msgstr "polecenie"
 msgid "orphan"
 msgstr "osierocone"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "hasło"
@@ -699,7 +708,7 @@ msgstr "arkusz stylów"
 msgid "subtotal"
 msgstr "podsuma"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "informacja o podatku"
@@ -788,5 +797,9 @@ msgstr "kwit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "obciążenie"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "faktura"
+
 #~ msgid "Term"
 #~ msgstr "Termin"
diff --git a/po/glossary/pt.po b/po/glossary/pt.po
index 6cd4c36..462ffed 100644
--- a/po/glossary/pt.po
+++ b/po/glossary/pt.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-2.4\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2011-08-17 13:23-0000\n"
 "Last-Translator: Tiago Neiva <tneiva at gmail.com>\n"
 "Language-Team: Portuguese <translation-team-pt at lists.sourceforge.net>\n"
@@ -46,6 +46,11 @@ msgstr "tipo de conta: Ativo"
 msgid "account type: Asset"
 msgstr "tipo de conta: Ativo"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "tipo de conta: Passivo"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "tipo de conta: à ordem"
@@ -84,6 +89,11 @@ msgstr "tipo de conta: Fundo de investimento"
 msgid "account type: Passive"
 msgstr "tipo de conta: Ativo"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "tipo de conta: Ativo"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "tipo de conta: a prazo"
@@ -157,7 +167,7 @@ msgstr "ação: empréstimo"
 msgid "action: payment"
 msgstr "ação: pagamento"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "ação: Terminal de Pagamento Automático"
 
@@ -405,7 +415,7 @@ msgstr "calculadora financeira: pagamentos"
 msgid "gain"
 msgstr "ganho"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 #, fuzzy
 msgid "imbalance"
 msgstr "desequilíbrio"
@@ -426,11 +436,6 @@ msgstr "juro"
 msgid "invoice"
 msgstr "fatura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "fatura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "obra"
@@ -533,6 +538,10 @@ msgstr "nota de encomenda"
 msgid "orphan"
 msgstr "orfão"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "senha"
@@ -716,7 +725,7 @@ msgstr "folha de estilo"
 msgid "subtotal"
 msgstr "subtotal"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "info impostos"
@@ -805,6 +814,10 @@ msgstr "comprovativo de despesa"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "levantamento (no diálogo de reconciliação)"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "fatura"
+
 #~ msgid ""
 #~ "account type: trading This account type (new in gnucash-2.4.0) is used "
 #~ "when exchanging or trading amounts from one currency into another"
diff --git a/po/glossary/pt_BR.po b/po/glossary/pt_BR.po
index af33c63..9f8a01c 100644
--- a/po/glossary/pt_BR.po
+++ b/po/glossary/pt_BR.po
@@ -10,7 +10,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: 1.8\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2007-07-08 00:44-0300\n"
 "Last-Translator: Leonardo Ferreira Fontenelle <leo.fontenelle at gmail.com>\n"
 "Language-Team: none\n"
@@ -48,6 +48,11 @@ msgstr "Ativo"
 msgid "account type: Asset"
 msgstr "Ativo"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Passivo"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "corrente"
@@ -85,6 +90,11 @@ msgstr "Fundo mútuo"
 msgid "account type: Passive"
 msgstr "Ativo"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Ativo"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "poupança"
@@ -158,7 +168,7 @@ msgstr "empréstimo"
 msgid "action: payment"
 msgstr "pagamento"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "POS"
 
@@ -402,7 +412,7 @@ msgstr "pagamentos"
 msgid "gain"
 msgstr "ganho"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "desequilíbrio"
 
@@ -422,11 +432,6 @@ msgstr "juros"
 msgid "invoice"
 msgstr "fatura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "fatura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "serviço"
@@ -528,6 +533,10 @@ msgstr "pedido"
 msgid "orphan"
 msgstr "órfã"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "senha"
@@ -702,7 +711,7 @@ msgstr "folha de estilo"
 msgid "subtotal"
 msgstr "subtotal"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "info de impostos"
@@ -791,6 +800,10 @@ msgstr "vale"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "saque"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "fatura"
+
 #~ msgid "transfer, to"
 #~ msgstr "transferir"
 
diff --git a/po/glossary/ru.po b/po/glossary/ru.po
index cd4e01c..6696569 100644
--- a/po/glossary/ru.po
+++ b/po/glossary/ru.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: ru\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2008-01-30 00:10+0300\n"
 "Last-Translator: Sergey Belyashov <Sergey.Belyashov at gmail.com>\n"
 "Language-Team: russian <ru at li.org>\n"
@@ -48,6 +48,11 @@ msgstr "account type: Актив"
 msgid "account type: Asset"
 msgstr "account type: Актив"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "account type: Обязательства"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "account type: чеки"
@@ -85,6 +90,11 @@ msgstr "account type: Взаимный фонд"
 msgid "account type: Passive"
 msgstr "account type: Актив"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "account type: Актив"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "account type: депозит"
@@ -158,7 +168,7 @@ msgstr "action: займ"
 msgid "action: payment"
 msgstr "action: платеж"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr ""
 
@@ -406,7 +416,7 @@ msgstr "financial calculator: платежи"
 msgid "gain"
 msgstr "прибыль"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 #, fuzzy
 msgid "imbalance"
 msgstr "несоответствие"
@@ -427,11 +437,6 @@ msgstr "процент"
 msgid "invoice"
 msgstr "счет-фактура"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "счет-фактура"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "операция"
@@ -535,6 +540,10 @@ msgstr "заказ"
 msgid "orphan"
 msgstr "упущенный"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "пароль"
@@ -709,7 +718,7 @@ msgstr "стиль оформления"
 msgid "subtotal"
 msgstr "предварительный итог"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "информация о налоге"
@@ -800,5 +809,9 @@ msgstr "товарный чек"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "снятие"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "счет-фактура"
+
 #~ msgid "Term"
 #~ msgstr "Термин"
diff --git a/po/glossary/rw.po b/po/glossary/rw.po
index 050006e..9e15457 100644
--- a/po/glossary/rw.po
+++ b/po/glossary/rw.po
@@ -14,7 +14,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 1.8.9\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2005-04-04 10:55-0700\n"
 "Last-Translator: Steven Michael Murphy <murf at e-tools.com>\n"
 "Language-Team: Kinyarwanda <translation-team-rw at lists.sourceforge.net>\n"
@@ -59,6 +59,11 @@ msgstr "Aderesi Ubwoko"
 msgid "account type: Asset"
 msgstr "Aderesi Ubwoko"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "Aderesi Ubwoko"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 #, fuzzy
 msgid "account type: checking"
@@ -104,6 +109,11 @@ msgstr "Aderesi Ubwoko"
 msgid "account type: Passive"
 msgstr "Aderesi Ubwoko"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "Aderesi Ubwoko"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 #, fuzzy
 msgid "account type: saving"
@@ -194,7 +204,7 @@ msgstr "Igikorwa"
 msgid "action: payment"
 msgstr "Igikorwa"
 
-#. "-"
+#. "Point of sale"
 #, fuzzy
 msgid "action: POS"
 msgstr "Igikorwa"
@@ -485,7 +495,7 @@ msgstr "Bijyanye n'umutungo Ubwishyu"
 msgid "gain"
 msgstr ""
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr ""
 
@@ -507,10 +517,6 @@ msgstr ""
 msgid "invoice"
 msgstr ""
 
-#. "The customer (or vendor) to which this invoice is sent to."
-msgid "invoice owner"
-msgstr ""
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr ""
@@ -626,6 +632,10 @@ msgstr "Itondekanya"
 msgid "orphan"
 msgstr ""
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr ""
@@ -836,7 +846,7 @@ msgstr "Urupapuro rw'Imisusire"
 msgid "subtotal"
 msgstr "IGITERANYOCYUNGIRIJE"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "Ibisobanuro"
diff --git a/po/glossary/sk.po b/po/glossary/sk.po
index 564abaa..653db49 100644
--- a/po/glossary/sk.po
+++ b/po/glossary/sk.po
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2008-11-14 21:02+0100\n"
 "Last-Translator: Zdenko Podobny <zdenop at gmail.com>\n"
 "Language-Team: Slovak <sk-i18n at lists.linux.sk>\n"
@@ -47,6 +47,11 @@ msgstr "account type: Aktíva"
 msgid "account type: Asset"
 msgstr "account type: Aktíva"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "account type: Záväzky"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "account type: bežný účet"
@@ -84,6 +89,11 @@ msgstr "account type: Podielový fond"
 msgid "account type: Passive"
 msgstr "account type: Aktíva"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "account type: Aktíva"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "account type: sporiaci účet"
@@ -157,7 +167,7 @@ msgstr "action: úver"
 msgid "action: payment"
 msgstr "action: platba"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "action: POS"
 
@@ -401,7 +411,7 @@ msgstr "financial calculator: platby"
 msgid "gain"
 msgstr "výnos"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "nerovnováha"
 
@@ -421,11 +431,6 @@ msgstr "úrok"
 msgid "invoice"
 msgstr "faktúra"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "faktúra"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "úloha"
@@ -527,6 +532,10 @@ msgstr "objednávka"
 msgid "orphan"
 msgstr "sirota"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "heslo"
@@ -701,7 +710,7 @@ msgstr "štýl"
 msgid "subtotal"
 msgstr "medzisúčet"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "daňové informácie"
@@ -789,3 +798,7 @@ msgstr "náhrada hotovostných výdajov"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "výber (v dialógu vysporiadania)"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "faktúra"
diff --git a/po/glossary/sv.po b/po/glossary/sv.po
index f796e67..49b0c0e 100644
--- a/po/glossary/sv.po
+++ b/po/glossary/sv.po
@@ -8,7 +8,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary 1.9.1\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2006-05-04 07:47+0200\n"
 "Last-Translator: Jonas Norling <norling at lysator.liu.se>\n"
 "Language-Team: Swedish <tp-sv at listor.tp-sv.se>\n"
@@ -46,6 +46,11 @@ msgstr "kontotyp: Tillgång"
 msgid "account type: Asset"
 msgstr "kontotyp: Tillgång"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "kontotyp: Skuld"
+
 # src/prefs.c:210
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
@@ -84,6 +89,11 @@ msgstr "kontotyp: aktiefond"
 msgid "account type: Passive"
 msgstr "kontotyp: Tillgång"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "kontotyp: Tillgång"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "kontotyp: spar"
@@ -157,7 +167,7 @@ msgstr "händelse: lån"
 msgid "action: payment"
 msgstr "händelse: betalning"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "händelse: POS"
 
@@ -401,7 +411,7 @@ msgstr "finansiell miniräknare: betalningar"
 msgid "gain"
 msgstr "vinst"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "obalans"
 
@@ -421,11 +431,6 @@ msgstr "ränta"
 msgid "invoice"
 msgstr "faktura"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "faktura"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "jobb"
@@ -529,6 +534,10 @@ msgstr "order"
 msgid "orphan"
 msgstr "föräldralös"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "lösenfras"
@@ -704,7 +713,7 @@ msgstr "stilmall"
 msgid "subtotal"
 msgstr "delsumma"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "skatteinformation"
@@ -794,5 +803,9 @@ msgstr ""
 msgid "withdraw (in the reconcile dialog)"
 msgstr "uttag (i avstämningsdialogen)"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "faktura"
+
 #~ msgid "Term"
 #~ msgstr "Term"
diff --git a/po/glossary/vi.po b/po/glossary/vi.po
index 17a6a41..ad71276 100644
--- a/po/glossary/vi.po
+++ b/po/glossary/vi.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary-1.9.1\n"
 "Report-Msgid-Bugs-To: bug-gnucash at gnu.org\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2006-03-09 22:30+1030\n"
 "Last-Translator: Clytie Siddall <clytie at riverland.net.au>\n"
 "Language-Team: Vietnamese <gnomevi-list at lists.sourceforge.net>\n"
@@ -46,6 +46,11 @@ msgstr "kiểu tài khoản: tài sản"
 msgid "account type: Asset"
 msgstr "kiểu tài khoản: tài sản"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "kiểu tài khoản: nợ"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "kiểu tài khoản: hàng ngày"
@@ -83,6 +88,11 @@ msgstr "kiểu tài khoản: quỹ lẫn nhau"
 msgid "account type: Passive"
 msgstr "kiểu tài khoản: tài sản"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "kiểu tài khoản: tài sản"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "kiểu tài khoản: tiết kiệm"
@@ -156,7 +166,7 @@ msgstr "hành động: tín dụng"
 msgid "action: payment"
 msgstr "hành động: trả tiền"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "hành động: điểm bán"
 
@@ -400,7 +410,7 @@ msgstr "máy tính tài chính: số tiền trả"
 msgid "gain"
 msgstr "lợi"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "chưa cân bằng"
 
@@ -420,11 +430,6 @@ msgstr "lãi"
 msgid "invoice"
 msgstr "hóa đơn gởi"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "hóa đơn gởi"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr "việc"
@@ -526,6 +531,10 @@ msgstr "đặt hàng"
 msgid "orphan"
 msgstr "chưa kết hợp"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "cụm từ mật khẩu"
@@ -700,7 +709,7 @@ msgstr "tờ kiểu dạng"
 msgid "subtotal"
 msgstr "tổng phụ"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "thông tin thuế"
@@ -789,5 +798,9 @@ msgstr "chứng chỉ"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "rút (trong hộp thoại điều hoà)"
 
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "hóa đơn gởi"
+
 #~ msgid "Term"
 #~ msgstr "Kỹ thuật"
diff --git a/po/glossary/zh_CN.po b/po/glossary/zh_CN.po
index e31d136..5c6bbdf 100644
--- a/po/glossary/zh_CN.po
+++ b/po/glossary/zh_CN.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2010-05-05 13:47+1000\n"
 "Last-Translator: Tao Wang <dancefire at gmail.com>\n"
 "Language-Team: Simplified Chinese <LL at li.org>\n"
@@ -48,6 +48,12 @@ msgstr "科目类型:资产"
 msgid "account type: Asset"
 msgstr "科目类型:资产"
 
+# 债务,财政义务
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "科目类型:负债"
+
 # 英国称为 current account 即,现金流账户。是指一个可以随意从银行取款而不需要事先通知的银行账户
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
@@ -89,6 +95,12 @@ msgstr "科目类型:投资基金"
 msgid "account type: Passive"
 msgstr "科目类型:资产"
 
+# 某人或某公司持有的某个事物,其有价值并且可以被使用或销售以支付债务
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "科目类型:资产"
+
 # 1. (美国) 任何赚取利息的账户类型
 # 2. (英国) 任何比现金流账户或存款账户利息更高的银行账户
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
@@ -174,7 +186,7 @@ msgstr "操作:贷款"
 msgid "action: payment"
 msgstr "操作:支付"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "操作:POS"
 
@@ -472,7 +484,7 @@ msgid "gain"
 msgstr "收益"
 
 # 自动创建科目的名字,用以将不平衡的交易恢复平衡。
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "不平衡"
 
@@ -499,15 +511,6 @@ msgstr "利息"
 msgid "invoice"
 msgstr "发票"
 
-# 一个销售的物品或提供的服务含收费价格的列表。
-# 见:账单
-# 在 GnuCash 中,“发票”是我们发出(给客户)的声明,而“账单”是我们(从厂商)收到的声明。
-# Post Invoice,应该翻译为“入账”。
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "发票"
-
 # 在商业会计中:任务是一个你可以将同一个客户或厂商的多个发票或账单合起来的一种机制。任务描述了订购过程中一(大)块工作或任务,会处理它的一个或多个发票或账单。
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
@@ -636,6 +639,10 @@ msgstr "订单"
 msgid "orphan"
 msgstr "孤立的"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 # 用于访问用户账户所需要知道的秘密用语。
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
@@ -847,7 +854,7 @@ msgid "subtotal"
 msgstr "小计"
 
 # 科目的一个字段
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "税务信息"
@@ -954,3 +961,11 @@ msgstr "凭证"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "取款 (在对账对话框)"
+
+# 一个销售的物品或提供的服务含收费价格的列表。
+# 见:账单
+# 在 GnuCash 中,“发票”是我们发出(给客户)的声明,而“账单”是我们(从厂商)收到的声明。
+# Post Invoice,应该翻译为“入账”。
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "发票"
diff --git a/po/glossary/zh_TW.po b/po/glossary/zh_TW.po
index 6d6401a..94c04bc 100644
--- a/po/glossary/zh_TW.po
+++ b/po/glossary/zh_TW.po
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gnucash-glossary\n"
-"POT-Creation-Date: 2014-10-13 00:33+0200\n"
+"POT-Creation-Date: 2017-10-20 19:04+0200\n"
 "PO-Revision-Date: 2011-03-10 22:11+0800\n"
 "Last-Translator: Kuang-che Wu <kcwu at csie.org>\n"
 "Language-Team: traditional Chinese <zh-l10n at linux.org.tw>\n"
@@ -44,6 +44,11 @@ msgstr "科目類型:資產"
 msgid "account type: Asset"
 msgstr "科目類型:資產"
 
+#. "in fact: 'Active & Passive', group aka 'Balance Sheet accounts'; complement of 'Profit & Loss'"
+#, fuzzy
+msgid "account type: Assets & Liabilities"
+msgstr "科目類型:負債"
+
 #. "(esp. US) (Brit = current account) a bank account from which money can be withdrawn without previous notice"
 msgid "account type: checking"
 msgstr "科目類型:支票"
@@ -81,6 +86,11 @@ msgstr "科目類型:共同基金"
 msgid "account type: Passive"
 msgstr "科目類型:資產"
 
+#. "Group of accounts tracking your success, complement of 'Assets & Liabilities'"
+#, fuzzy
+msgid "account type: Profit & Loss"
+msgstr "科目類型:資產"
+
 #. "1. (US) any type of account that earns interest 2. (Brit) any type of bank account that earns a higher level of interest than a current account or deposit account"
 msgid "account type: saving"
 msgstr "科目類型:儲蓄"
@@ -154,7 +164,7 @@ msgstr "動作:貸款"
 msgid "action: payment"
 msgstr "動作:付款"
 
-#. "-"
+#. "Point of sale"
 msgid "action: POS"
 msgstr "動作:POS"
 
@@ -397,7 +407,7 @@ msgstr "金融計算機:付款"
 msgid "gain"
 msgstr "獲利"
 
-#. "Name of an automaticly created account to get imbalanced transactions back in balance"
+#. "Name of an automatically created account to get imbalanced transactions back in balance"
 msgid "imbalance"
 msgstr "失調"
 
@@ -417,11 +427,6 @@ msgstr "利息"
 msgid "invoice"
 msgstr "發票"
 
-#. "The customer (or vendor) to which this invoice is sent to."
-#, fuzzy
-msgid "invoice owner"
-msgstr "發票"
-
 #. "In business accounting: Jobs are a mechanism by which you can group multiple invoices or bills that belong to the same customer or vendor. The job describes a (larger) piece of work or a task undertaken on order, for which one or many invoices or bills will be issued."
 msgid "job"
 msgstr ""
@@ -523,6 +528,10 @@ msgstr ""
 msgid "orphan"
 msgstr "無主的"
 
+#. "The customer to (or employee or vendor from) which this invoice is sent - or short your business partner."
+msgid "owner (of bill, invoice or expense voucher)"
+msgstr ""
+
 #. "A secret phrase that one needs to know in order to get access to a user account "
 msgid "passphrase"
 msgstr "通關密語"
@@ -697,7 +706,7 @@ msgstr "樣式表格"
 msgid "subtotal"
 msgstr "小計"
 
-#. "On the goverment's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
+#. "On the government's tax forms, the tax code identifies the given line or place on the form where certain amounts must be specified according to the current country's legislation"
 #, fuzzy
 msgid "tax code"
 msgstr "稅務資訊"
@@ -785,3 +794,7 @@ msgstr "憑證"
 #. "see debit"
 msgid "withdraw (in the reconcile dialog)"
 msgstr "提出(在對帳對話盒)"
+
+#, fuzzy
+#~ msgid "invoice owner"
+#~ msgstr "發票"

commit 78cd5416c11dc24d346a6c2dcf056565793447f1
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 18:05:47 2017 +0200

    Mayor overhaul of de.po
    
    Fix accelerators
    4682 translated messages, 3 untranslated messages.

diff --git a/po/de.po b/po/de.po
index a1c0f5f..8476429 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1120,7 +1120,8 @@ msgstr "Zuletzt geöffnete Datei nicht öffnen"
 msgid ""
 "Set the prefix for gsettings schemas for gsettings queries. This can be "
 "useful to have a different settings tree while debugging."
-msgstr ""
+msgstr "Setzt den Präfix für »gsettings schemas«. Das kann nützlich sein, um "
+"andere Einstellungen beim Entwanzen zu verwenden."
 
 #. Translators: Argument description for autohelp; see
 #. http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html
@@ -1169,7 +1170,7 @@ msgstr ""
 #: ../src/bin/gnucash-bin.c:159
 msgid "You can also lookup and file bug reports at http://bugzilla.gnome.org"
 msgstr ""
-"Fehlerberichte können auf http://bugzilla.gnome.org eingeschickt werden."
+"Fehlerberichte können auf http://bugzilla.gnome.org eingesehen und erstellt werden."
 
 #: ../src/bin/gnucash-bin.c:160
 msgid "To find the last stable version, please refer to http://www.gnucash.org"
@@ -1250,8 +1251,11 @@ msgid ""
 "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 ?"
-msgstr ""
-
+msgstr "Fehler: Die graphische Benutzerschnittstelle konnte nicht "
+"initialisiert werden, obwohl die Option »add-price-quotes« nicht gesetzt "
+"war.\n"
+"       Möglicherweise müssen Sie die Umgebungsvariable $DISPLAY setzen?"
+# Fixme: Source Accelerator missing in dialog-invoice?
 #: ../src/business/business-gnome/business-gnome-utils.c:73
 #: ../src/business/business-gnome/business-gnome-utils.c:260
 #: ../src/business/business-gnome/dialog-invoice.c:1315
@@ -1345,7 +1349,7 @@ msgstr "Ungültige Konto Entität: %s"
 
 #: ../src/business/business-gnome/dialog-billterms.c:265
 msgid "Discount days cannot be more than due days."
-msgstr ""
+msgstr "»Tage für Skonto« kann nicht größer als »Fälligkeitstage« sein."
 
 #: ../src/business/business-gnome/dialog-billterms.c:324
 msgid "You must provide a name for this Billing Term."
@@ -1465,6 +1469,7 @@ msgstr "Aufträge des Kunden"
 msgid "Customer's Invoices"
 msgstr "Rechnungen des Kunden"
 
+# Fixme: Source Accelerator(s) missing in dialog-invoice?
 #: ../src/business/business-gnome/dialog-customer.c:907
 #: ../src/business/business-gnome/dialog-employee.c:712
 #: ../src/business/business-gnome/dialog-invoice.c:2999
@@ -1474,7 +1479,7 @@ msgstr "Rechnungen des Kunden"
 #: ../src/business/business-gnome/dialog-job.c:549
 #: ../src/business/business-gnome/gtkbuilder/dialog-payment.glade.h:1
 msgid "Process Payment"
-msgstr "Zahlung verarbeiten"
+msgstr "_Zahlung verarbeiten"
 
 #: ../src/business/business-gnome/dialog-customer.c:917
 msgid "Shipping Contact"
@@ -1799,15 +1804,17 @@ msgstr "Datum der kopierten Einträge"
 msgid ""
 "One or more selected invoices have already been posted.\n"
 "Re-check your selection."
-msgstr ""
+msgstr "Eine oder mehrere ausgewählte Rechnungen wurden bereits gebucht.\n"
+"Überprüfen Sie Ihre Auswahl."
 
 #: ../src/business/business-gnome/dialog-invoice.c:2932
 msgid "Do you really want to post these invoices?"
 msgstr "Wollen Sie diese Rechnungen wirklich buchen?"
 
+# Fixme: Source Accelerator missing
 #: ../src/business/business-gnome/dialog-invoice.c:2998
 msgid "View/Edit Invoice"
-msgstr "Rechnung anzeigen/bearbeiten"
+msgstr "_Rechnung anzeigen/bearbeiten"
 
 #: ../src/business/business-gnome/dialog-invoice.c:3000
 #: ../src/business/business-gnome/dialog-invoice.c:3009
@@ -2339,9 +2346,10 @@ msgstr "_Zahlung verarbeiten..."
 msgid "Open the Process Payment dialog"
 msgstr "Den Dialog für das Eingeben von Zahlungen öffnen"
 
+# Fixme: Source Accelerator missing
 #: ../src/business/business-gnome/gnc-plugin-business.c:197
 msgid "Vendors Overview"
-msgstr "Lieferantenübersicht"
+msgstr "Lieferantenüber_sicht"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:198
 msgid "Open a Vendor overview page"
@@ -2371,7 +2379,7 @@ msgstr "Den Dialog für die Suche nach Lieferanten öffnen"
 #: ../src/business/business-gnome/gnc-plugin-business.c:213
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:187
 msgid "New _Bill..."
-msgstr "Neue Lieferantenrechnung..."
+msgstr "N_eue Lieferantenrechnung..."
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:214
 msgid "Open the New Bill dialog"
@@ -2387,9 +2395,10 @@ msgstr "Lieferanten_rechnung suchen..."
 msgid "Open the Find Bill dialog"
 msgstr "Den Dialog für die Suche nach Rechnungen öffnen"
 
+# Fixme: Source Accelerator missing
 #: ../src/business/business-gnome/gnc-plugin-business.c:240
 msgid "Employees Overview"
-msgstr "Mitarbeiterübersicht"
+msgstr "Mitarbeiterüber_sicht"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:241
 msgid "Open a Employee overview page"
@@ -2402,7 +2411,7 @@ msgstr "_Mitarbeiter"
 #: ../src/business/business-gnome/gnc-plugin-business.c:246
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:166
 msgid "_New Employee..."
-msgstr "Neuer Mitarbeiter..."
+msgstr "_Neuer Mitarbeiter..."
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:247
 msgid "Open the New Employee dialog"
@@ -2435,7 +2444,7 @@ msgstr "Den Dialog für die Suche nach Auslagenerstattungen öffnen"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:273
 msgid "Sales _Tax Table"
-msgstr "Steuertabelle..."
+msgstr "MwSt.-_Steuertabelle..."
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:274
 msgid "View and edit the list of Sales Tax Tables (GST/VAT)"
@@ -2443,7 +2452,7 @@ msgstr "Liste der Steuertabellen (MwSt./USt.) anzeigen und bearbeiten"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:278
 msgid "_Billing Terms Editor"
-msgstr "Zahlungsbedingungen"
+msgstr "Tabelle für _Zahlungsbedingungen"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:279
 msgid "View and edit the list of Billing Terms"
@@ -2451,7 +2460,7 @@ msgstr "Liste der Zahlungsbedingungen anzeigen und bearbeiten"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:283
 msgid "Bills _Due Reminder"
-msgstr "Erinnerung an fällige Rechnungen"
+msgstr "Erinnerung an _fällige Rechnungen"
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:284
 msgid "Open the Bills Due Reminder dialog"
@@ -2471,9 +2480,10 @@ msgstr "Den Such-Dialog testen"
 msgid "Initialize Test Data"
 msgstr "Testdaten zurücksetzen"
 
+# Fixme: Source Accelerator missing
 #: ../src/business/business-gnome/gnc-plugin-business.c:311
 msgid "Assign as payment..."
-msgstr "Als Zahlung zuweisen..."
+msgstr "Als _Zahlung zuweisen..."
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:312
 msgid "Assign the selected transaction as payment"
@@ -2518,7 +2528,7 @@ msgstr "E_infügen"
 
 #: ../src/business/business-gnome/gnc-plugin-page-invoice.c:129
 msgid "_Edit Invoice"
-msgstr "Rechnung bearbeiten"
+msgstr "Rechnung be_arbeiten"
 
 #: ../src/business/business-gnome/gnc-plugin-page-invoice.c:130
 msgid "Edit this invoice"
@@ -2552,7 +2562,7 @@ msgstr ""
 
 #: ../src/business/business-gnome/gnc-plugin-page-invoice.c:151
 msgid "_Enter"
-msgstr "Ãœbernehmen"
+msgstr "_Ãœbernehmen"
 
 #: ../src/business/business-gnome/gnc-plugin-page-invoice.c:152
 msgid "Record the current entry"
@@ -2788,19 +2798,19 @@ msgstr "_Filtern nach..."
 
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:188
 msgid "Create a new bill"
-msgstr "Eine neue Rechnung anlegen"
+msgstr "Eine neue Lieferantenrechnung erfassen"
 
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:193
 msgid "Create a new invoice"
-msgstr "Eine neue Rechnung anlegen"
+msgstr "Eine neue Kundenrechnung erstellen"
 
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:197
 msgid "New _Voucher..."
-msgstr "Neue Gutschrift..."
+msgstr "Neuer _Auslagenbeleg..."
 
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:198
 msgid "Create a new voucher"
-msgstr "Neue Gutschrift erstellen"
+msgstr "Neuen Auslagenbeleg erfassen"
 
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:202
 #: ../src/business/business-gnome/gnc-plugin-page-owner-tree.c:277
@@ -3049,6 +3059,12 @@ msgid ""
 "opposite sign. For example for a bill, vendor credit notes and negative "
 "bills are considered counter documents."
 msgstr ""
+"Während des Buchungsvorgangs wird versucht Lieferantendokumente mit bereits "
+"geleisteten Vorauszahlungen und Gegendokumenten zu verrechnen. Die "
+"Vorauszahlungen und Gegendokumente müssen natürlich denselben Lieferanten "
+"betreffen. Gegendokumente sind Dokumente mit umgekehrtem Vorzeichen. Zu "
+"einer Rechnung wären beispielsweise Gutschriften und negative Rechnungen als "
+"Gegendokumente zu betrachten."
 
 #: ../src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in.h:18
 msgid "Show bills due reminder at startup"
@@ -3210,12 +3226,12 @@ msgstr "Bericht zum _Drucken:"
 #. See the tooltip "At post time..." for details.
 #: ../src/business/business-gnome/gtkbuilder/business-prefs.glade.h:26
 msgid "_Process payments on posting"
-msgstr "Automatisch durchbuchen"
+msgstr "Automatisch _verrechnen"
 
 #. See the tooltip "At post time..." for details.
 #: ../src/business/business-gnome/gtkbuilder/business-prefs.glade.h:29
 msgid "Pro_cess payments on posting"
-msgstr "Automatisch durchbuchen"
+msgstr "Automatisch ver_rechnen"
 
 #: ../src/business/business-gnome/gtkbuilder/dialog-billterms.glade.h:1
 msgid "Cancel your changes"
@@ -3493,6 +3509,8 @@ msgstr "Rechnungsadresse"
 msgid "Notes"
 msgstr "Bemerkung"
 
+# Fixme: Source 1. Accelerator missing "assign payment"
+#   2. Comment misplaced
 #. Translators: "Markup" is profit amount divided by sales amount
 #: ../src/business/business-gnome/gtkbuilder/dialog-customer.glade.h:14
 #: ../src/business/business-gnome/gtkbuilder/dialog-invoice.glade.h:24
@@ -3632,7 +3650,7 @@ msgstr "Rechnungs-Informationen"
 #: ../src/business/business-gnome/gtkbuilder/dialog-order.glade.h:6
 #: ../src/business/business-gnome/gtkbuilder/dialog-payment.glade.h:3
 msgid "(owner)"
-msgstr "(Mandant)"
+msgstr "(Geschäftspartner)"
 
 #: ../src/business/business-gnome/gtkbuilder/dialog-invoice.glade.h:10
 #: ../src/business/business-gnome/search-owner.c:241
@@ -4087,7 +4105,7 @@ msgstr "sample(DH):+%"
 #: ../src/register/ledger-core/split-register-layout.c:722
 #: ../src/register/ledger-core/split-register-layout.c:730
 msgid "sample:Expenses:Automobile:Gasoline"
-msgstr "sample:Ausgaben:Automobil:Treibstoff"
+msgstr "sample:Aufwendungen 2/4:Reparatur/Instandhaltung:4805 Reparatur u. Instandh. von Anlagen/Maschinen u. Betriebs- u. Geschäftsausst."
 
 #: ../src/business/business-ledger/gncEntryLedgerLayout.c:125
 msgid "sample:T?"
@@ -4383,11 +4401,11 @@ msgid ""
 "Please correct the problem and restart GnuCash.\n"
 "The reported error was '%s' (errno %d).\n"
 msgstr ""
-"Ein unbekannter Fehler ist aufgetreten, als nach dem Verzeichnis\n"
+"Ein Fehler ist aufgetreten, als das Verzeichnis\n"
 "  %s\n"
-"gesucht wurde. Bitte berichten Sie den Fehler an die Programmierer und\n"
-"starten Sie GnuCash neu. \n"
-"Nennen Sie bitte diesen Fehlertext: »%s« (errno %d)\n"
+"erstellt werden sollte. Bitte beheben Sie das Problem und\n"
+"starten Sie GnuCash neu.\n"
+"Folgender Fehler wurde gemeldet: »%s« (errno %d)\n"
 
 #: ../src/core-utils/gnc-filepath-utils.c:338
 #, c-format
@@ -4415,6 +4433,7 @@ msgstr ""
 "Programm muss alle Zugriffrechte (Lesen/Schreiben/Ausführen) zu diesem\n"
 "Verzeichnis besitzen, um korrekt zu funktionieren.\n"
 
+# Fixme: Check source
 #: ../src/core-utils/gnc-filepath-utils.c:359
 #: ../src/core-utils/gnc-filepath-utils.c:381
 #, c-format
@@ -4429,6 +4448,7 @@ msgstr ""
 "existiert, ist aber kein Verzeichnis. Bitte löschen Sie diese Datei\n"
 "oder wählen einen anderen Pfad. Starten Sie dann GnuCash neu.\n"
 
+# Fixme: Source
 #: ../src/core-utils/gnc-filepath-utils.c:368
 #, c-format
 msgid ""
@@ -4438,12 +4458,11 @@ msgid ""
 "problem and restart GnuCash. The reported error \n"
 "was '%s' (errno %d)."
 msgstr ""
-"Ein unbekannter Fehler ist aufgetreten, als nach dem Verzeichnis\n"
+"Ein unbekannter Fehler ist aufgetreten, als das Verzeichnis\n"
 "  %s\n"
-"\n"
-"gesucht wurde. Bitte berichten Sie den Fehler an die Programmierer und\n"
-"starten Sie GnuCash neu. \n"
-"Nennen Sie bitte diesen Fehlertext: »%s« (errno %d)"
+"auf seine Existenz und Verwendbarkeit überprüft wurde.\n"
+"Bitte beheben Sie das Problem und starten Sie GnuCash neu.\n"
+"Der gemeldete Fehler war: »%s« (errno %d)."
 
 #: ../src/core-utils/gnc-filepath-utils.c:393
 #, c-format
@@ -4552,6 +4571,7 @@ msgstr "ALLE NICHT-WÄHRUNGEN"
 msgid "Unnamed Budget"
 msgstr "Unbenanntes Budget"
 
+# Fixme: Source
 #. Set memo.
 #: ../src/engine/gncInvoice.c:1574
 msgid "Extra to Charge Card"
@@ -4685,19 +4705,21 @@ msgstr "Jährlich"
 
 #: ../src/engine/ScrubBusiness.c:522
 msgid ""
-"Please delete this transaction. Explanation at http://wiki.gnucash.org/wiki/"
-"Business_Features_Issues#Double_Posting"
-msgstr ""
+"Please delete this transaction. Explanation at https://wiki.gnucash.org/wiki/"
+"Business_Features_Issues#Double_posting"
+msgstr "Bitte löschen sie diese Buchung. Die (englische) Erklärung befindet "
+"sich in https://wiki.gnucash.org/wiki/Business_Features_Issues#Double_posting"
 
+# Fixme: Bessere Lösung für die nächsten 2?
 #: ../src/engine/ScrubBusiness.c:592
 #, c-format
 msgid "Checking business lots in account %s: %u of %u"
-msgstr ""
+msgstr "Überprüfe geschäftliche Posten in Konto %s: %u von %u"
 
 #: ../src/engine/ScrubBusiness.c:642
 #, c-format
 msgid "Checking business splits in account %s: %u of %u"
-msgstr ""
+msgstr "Überprüfe geschäftliche Buchungsteile in Konto %s: %u von %u"
 
 #. Reason 2: zero Orphan a/c
 #: ../src/engine/Scrub.c:89 ../src/report/business-reports/balsheet-eg.scm:511
@@ -4707,12 +4729,12 @@ msgstr "Ausbuchungskonto"
 #: ../src/engine/Scrub.c:106
 #, c-format
 msgid "Looking for orphans in account %s: %u of %u"
-msgstr ""
+msgstr "Suche nach verwaisten Buchungen in Konto %s: %u von %u"
 
 #: ../src/engine/Scrub.c:302
 #, c-format
 msgid "Looking for imbalances in account %s: %u of %u"
-msgstr ""
+msgstr "Suche nach unausgeglichenen Buchungen in Konto %s: %u von %u"
 
 #. (> (accrec-depth accrec) 1))
 #. Reason 1: zero Imbalance a/c
@@ -4875,7 +4897,7 @@ msgstr "Steuern"
 
 #: ../src/gnome/assistant-loan.c:115
 msgid "Tax Payment"
-msgstr "Steuern"
+msgstr "Steuerzahlungen"
 
 #: ../src/gnome/assistant-loan.c:116
 msgid "Insurance"
@@ -4883,7 +4905,7 @@ msgstr "Versicherung"
 
 #: ../src/gnome/assistant-loan.c:116
 msgid "Insurance Payment"
-msgstr "Versicherung"
+msgstr "Zahlungen für Versicherungen"
 
 #. Translators: PMI stands for Private Mortgage Insurance.
 #: ../src/gnome/assistant-loan.c:118
@@ -4892,15 +4914,15 @@ msgstr "Hypothekenversicherung"
 
 #: ../src/gnome/assistant-loan.c:118
 msgid "PMI Payment"
-msgstr "Hypothekenversicherung"
+msgstr "Zahlungen für Hypothekenversicherungen"
 
 #: ../src/gnome/assistant-loan.c:119
 msgid "Other Expense"
-msgstr "Anderes"
+msgstr "Sonstiges"
 
 #: ../src/gnome/assistant-loan.c:119
 msgid "Miscellaneous Payment"
-msgstr "Anderes"
+msgstr "Sonstige Zahlungen"
 
 #. Add payment checkbox.
 #. Translators: %s is "Taxes",
@@ -4928,7 +4950,7 @@ msgstr "Darlehensrechner-Option: \"%s\""
 
 #: ../src/gnome/assistant-loan.c:1837 ../src/gnome/assistant-loan.c:2834
 msgid "Principal"
-msgstr "Endbetrag Kapital"
+msgstr "Tilgung"
 
 #: ../src/gnome/assistant-loan.c:1843 ../src/gnome/assistant-loan.c:2854
 #: ../src/gnome-utils/gnc-tree-model-split-reg.c:2882
@@ -5064,11 +5086,11 @@ msgstr "Der Zinssatz kann nicht Null sein."
 
 #: ../src/gnome/dialog-fincalc.c:372
 msgid "The number of payments cannot be zero."
-msgstr "Die Anzahl der Zahlungen kann nicht Null sein"
+msgstr "Die Anzahl der Zahlungen kann nicht Null sein."
 
 #: ../src/gnome/dialog-fincalc.c:377
 msgid "The number of payments cannot be negative."
-msgstr "Die Anzahl der Zahlungen kann nicht negativ sein"
+msgstr "Die Anzahl der Zahlungen kann nicht negativ sein."
 
 #: ../src/gnome/dialog-find-transactions2.c:104
 #: ../src/gnome/dialog-find-transactions.c:103
@@ -5620,7 +5642,7 @@ msgstr "Summe"
 
 #: ../src/gnome/gnc-plugin-account-tree.c:59
 msgid "New Accounts _Page"
-msgstr "Neue _Kontenhierarchie"
+msgstr "Neue _Kontenübersicht"
 
 #: ../src/gnome/gnc-plugin-account-tree.c:60
 msgid "Open a new Account Tree page"
@@ -5628,7 +5650,7 @@ msgstr "Neue Ansicht der Kontenhierarchie öffnen"
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:107
 msgid "New _File"
-msgstr "Neue _Datei"
+msgstr "_Neue Datei"
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:108
 msgid "Create a new file"
@@ -5660,7 +5682,7 @@ msgstr "AKtuelle Datei mit einem neuen Namen speichern"
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:127
 msgid "Re_vert"
-msgstr "Änderungen verwerfen"
+msgstr "Änderungen ver_werfen"
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:128
 msgid "Reload the current database, reverting all unsaved changes"
@@ -5691,7 +5713,7 @@ msgstr "Finde Buchungssätze"
 #. * translation in dialog-account.glade
 #: ../src/gnome/gnc-plugin-basic-commands.c:149
 msgid "Ta_x Report Options"
-msgstr "Optionen _Steuerbericht"
+msgstr "_Optionen Steuerbericht"
 
 #. Translators: currently implemented are *
 #. * US: income tax and                     *
@@ -5706,9 +5728,10 @@ msgstr "Konten für Steuerbericht (MwSt.) einrichten"
 msgid "_Scheduled Transactions"
 msgstr "Term_inierte Buchungen"
 
+# Fixme: Source should have HEllip?
 #: ../src/gnome/gnc-plugin-basic-commands.c:162
 msgid "_Scheduled Transaction Editor"
-msgstr "Terminierte Buchungen Editor"
+msgstr "Terminierte Buchungen _Editor"
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:163
 msgid "The list of Scheduled Transactions"
@@ -5800,7 +5823,7 @@ msgstr ""
 
 #: ../src/gnome/gnc-plugin-basic-commands.c:554
 msgid "There are no Scheduled Transactions to be entered at this time."
-msgstr "Es gibt keine terminierten Buchungen, die gebucht werden sollten."
+msgstr "Es gibt derzeit keine terminierten Buchungen, die gebucht werden sollten."
 
 #. Translators: %d is the number of transactions. This is a
 #. ngettext(3) message.
@@ -5853,7 +5876,7 @@ msgstr "Ein neues Konto eröffnen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:171
 msgid "New Account _Hierarchy..."
-msgstr "Konten_hierarchie _hinzufügen"
+msgstr "Konten_hierarchie hinzufügen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:172
 msgid "Extend the current book by merging with new account type categories"
@@ -5874,14 +5897,12 @@ msgid "Open the selected account"
 msgstr "Gewähltes Konto öffnen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:182
-#, fuzzy
 msgid "Open _Old Style Register Account"
-msgstr "Gewähltes Konto öffnen"
+msgstr "Gewähltes Konto im _alten Registerstil öffnen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:183
-#, fuzzy
 msgid "Open the old style register selected account"
-msgstr "Gewähltes Konto öffnen"
+msgstr "Gewähltes Konto im alten Registerstil öffnen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:196
 #: ../src/gnome/gnc-plugin-page-account-tree.c:207
@@ -5897,14 +5918,12 @@ msgid "Open the selected account and all its subaccounts"
 msgstr "Öffne das gewählte Konto und alle Unterkonten"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:201
-#, fuzzy
 msgid "Open Old St_yle Subaccounts"
-msgstr "_Unterkonten öffnen"
+msgstr "_Unterkonten im alten Stil öffnen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:202
-#, fuzzy
 msgid "Open the old style register selected account and all its subaccounts"
-msgstr "Öffne das gewählte Konto und alle Unterkonten"
+msgstr "Öffne das gewählte Konto und alle Unterkonten in der alten Kontoansicht"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:215
 #: ../src/gnome/gnc-plugin-page-register2.c:241
@@ -5920,7 +5939,7 @@ msgstr "Ausgewähltes Konto bearbeiten"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:220
 msgid "_Delete Account..."
-msgstr "_Konto löschen..."
+msgstr "Konto _löschen..."
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:221
 msgid "Delete selected account"
@@ -5928,7 +5947,7 @@ msgstr "Ausgewähltes Konto löschen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:225
 msgid "_Renumber Subaccounts..."
-msgstr "_Unterkonten neu nummerieren..."
+msgstr "Unterkonten neu _nummerieren..."
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:226
 msgid "Renumber the children of the selected account"
@@ -6039,9 +6058,8 @@ msgid "_Register2"
 msgstr "_Kontobuch Vers. 2"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:342
-#, fuzzy
 msgid "Open2"
-msgstr "Öffnen"
+msgstr "Öffnen (Vers. 2)"
 
 #. FIXME this needs an indent option
 #. FIXME this could use an indent option
@@ -6205,7 +6223,7 @@ msgstr "Buchung _kopieren"
 #: ../src/gnome/gnc-plugin-page-register2.c:192
 #: ../src/gnome/gnc-plugin-page-register.c:196
 msgid "_Paste Transaction"
-msgstr "Buchung _einfügen"
+msgstr "Buchung ein_fügen"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:193
 #: ../src/gnome/gnc-plugin-page-register.c:197
@@ -6217,7 +6235,7 @@ msgstr "Buchung dupli_zieren"
 #: ../src/gnome/gnc-split-reg.c:1335
 #: ../src/gnome-utils/gnc-tree-control-split-reg.c:1065
 msgid "_Delete Transaction"
-msgstr "_Buchung löschen"
+msgstr "Buchung _löschen"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:195
 #: ../src/gnome/gnc-plugin-page-register.c:202
@@ -6292,10 +6310,11 @@ msgstr "Den Buchungsteil von der Zwischenablage einfügen"
 msgid "Make a copy of the current split"
 msgstr "Kopie des aktuellen Buchungsteils erstellen"
 
+# tritt alternativ zu "Buchung _löschen" auf
 #: ../src/gnome/gnc-plugin-page-register2.c:209
 #: ../src/gnome/gnc-plugin-page-register.c:219
 msgid "Delete the current split"
-msgstr "Aktuellen Buchungsteil löschen"
+msgstr "Aktuellen Buchungsteil _löschen"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:219
 #: ../src/gnome/gnc-plugin-page-register.c:226
@@ -6349,7 +6368,7 @@ msgstr "Alle Buchungsteile im aktuellen Buchungssatz entfernen"
 #: ../src/gnome/gnc-plugin-page-register2.c:284
 #: ../src/gnome/gnc-plugin-page-register.c:291
 msgid "_Enter Transaction"
-msgstr "Buchung eingeben"
+msgstr "Buchung ein_geben"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:285
 #: ../src/gnome/gnc-plugin-page-register.c:292
@@ -6374,7 +6393,7 @@ msgstr "Buchung _ungültig machen"
 #: ../src/gnome/gnc-plugin-page-register2.c:298
 #: ../src/gnome/gnc-plugin-page-register.c:305
 msgid "_Unvoid Transaction"
-msgstr "Ungültige Buchung wieder_herstellen"
+msgstr "Ungültige Buchung _wiederherstellen"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:302
 #: ../src/gnome/gnc-plugin-page-register.c:309
@@ -6453,7 +6472,7 @@ msgstr "Den Wechselkurs für die gewählte Buchung bearbeiten"
 #: ../src/gnome/gnc-plugin-page-register.c:377
 #: ../src/gnome-utils/gnc-icons.c:45
 msgid "_Jump"
-msgstr "Ge_genbuchung"
+msgstr "_Gegenbuchung"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:367
 #: ../src/gnome/gnc-plugin-page-register.c:378
@@ -6474,13 +6493,14 @@ msgstr "Terminierte Buchung erstellen mit aktuellem Buchungssatz als Vorlage"
 #: ../src/gnome/gnc-plugin-page-register2.c:376
 #: ../src/gnome/gnc-plugin-page-register.c:387
 msgid "_All transactions"
-msgstr "Alle Buchungssätze"
+msgstr "_Alle Buchungssätze"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:380
 #: ../src/gnome/gnc-plugin-page-register.c:391
 msgid "_This transaction"
 msgstr "_Dieser Buchungssatz"
 
+# Fixme: Source Accelerator missing
 #: ../src/gnome/gnc-plugin-page-register2.c:387
 #: ../src/gnome/gnc-plugin-page-register.c:398
 msgid "Account Report"
@@ -6491,10 +6511,11 @@ msgstr "Kontenbericht"
 msgid "Open a register report for this Account"
 msgstr "Kontobuch als Bericht für dieses Konto öffnen"
 
+# Fixme: Source Accelerator missing
 #: ../src/gnome/gnc-plugin-page-register2.c:392
 #: ../src/gnome/gnc-plugin-page-register.c:403
 msgid "Account Report - Single Transaction"
-msgstr "Kontenbuch - Einzelüberweisung"
+msgstr "Kontenbuch - Einzelbuchung"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:393
 #: ../src/gnome/gnc-plugin-page-register.c:404
@@ -6553,8 +6574,8 @@ msgstr "_Aktive vollständig"
 msgid ""
 "Show transactions on one or two lines and expand the current transaction"
 msgstr ""
-"Alle Buchungssätze außer dem aktuellen einzeilig anzeigen. Den aktuellen "
-"Buchungssatz vollständig anzeigen."
+"Alle Buchungssätze außer dem aktuellen ein- bis zweizeilig anzeigen. "
+"Den aktuellen Buchungssatz vollständig anzeigen."
 
 #: ../src/gnome/gnc-plugin-page-register2.c:437
 #: ../src/gnome/gnc-plugin-page-register.c:442
@@ -6722,7 +6743,7 @@ msgstr ""
 #: ../src/gnome/gnc-plugin-page-register2.c:2644
 #: ../src/gnome/gnc-plugin-page-register.c:2819
 msgid "_Print checks"
-msgstr "Scheck_s drucken"
+msgstr "Schec_ks drucken"
 
 #: ../src/gnome/gnc-plugin-page-register2.c:2663
 #: ../src/gnome/gnc-plugin-page-register.c:2838
@@ -6776,12 +6797,12 @@ msgstr ""
 
 #: ../src/gnome/gnc-plugin-page-register.c:286
 msgid "Remo_ve Other Splits"
-msgstr "Andere Buchungsteile löschen"
+msgstr "Andere Buchungs_teile löschen"
 
 #: ../src/gnome/gnc-plugin-page-register.c:331
 #: ../src/gnome-utils/gnc-main-window.c:328
 msgid "_Sort By..."
-msgstr "_Sortieren nach..."
+msgstr "Sortieren _nach..."
 
 #: ../src/gnome/gnc-plugin-page-register.c:491
 msgid "Associate File"
@@ -6834,7 +6855,7 @@ msgstr "%s sortieren nach..."
 #: ../src/gnome/gnc-plugin-page-register.c:3798
 #, c-format
 msgid "Checking splits in current register: %u of %u"
-msgstr ""
+msgstr "Überprüfe Buchungsteile im aktuellen Konto: %u von %u"
 
 #: ../src/gnome/gnc-plugin-page-sx-list.c:132
 msgid "_Scheduled"
@@ -7030,7 +7051,7 @@ msgstr ""
 #: ../src/gnome/gnc-split-reg.c:985
 #: ../src/gnome-utils/gnc-tree-control-split-reg.c:888
 msgid "_Remove Splits"
-msgstr "Buchungsteile entfernen"
+msgstr "Buchungsteile _entfernen"
 
 #: ../src/gnome/gnc-split-reg.c:1178
 msgid "This transaction is not associated with a URI."
@@ -7621,11 +7642,12 @@ msgstr ""
 "Die Anzahl Minuten, bis die Datei automatisch gespeichert wird (»Auto-"
 "Speichern«). Wenn Null gesetzt ist, wird nichts automatisch gespeichert."
 
+# Fixme: Source Accelerators missing
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:11
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:105
 msgid "Enable timeout on \"Save changes on closing\" question"
 msgstr ""
-"Aktiviere Wartezeit bei \"Geänderte Datei speichern\"-Frage beim Schließen"
+"Aktiviere Wartezeit bei »Geänderte Datei speichern«-Frage beim Schließen"
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:12
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:106
@@ -7635,7 +7657,7 @@ msgid ""
 "that time, the changes will be saved automatically and the question window "
 "closed."
 msgstr ""
-"Wenn aktiviert, wird die \"Geänderte Datei speichern?\"-Frage nur einige "
+"Wenn aktiviert, wird die »Geänderte Datei speichern?«-Frage nur einige "
 "Sekunden auf eine Antwort warten. Wenn der Benutzer in dieser Zeit nicht "
 "reagiert, werden die Änderungen automatisch gespeichert und die Frage "
 "verschwindet."
@@ -7707,6 +7729,7 @@ msgstr ""
 msgid "Do not create log/backup files."
 msgstr "Keine Backup- und Log-Dateien erstellen."
 
+# Fixme: Source format can be improved by linebreaks
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:23
 msgid ""
 "This setting specifies what to do with old log/backups files. \"forever\" "
@@ -7714,7 +7737,13 @@ msgid ""
 "Each time you save, older versions of the file are removed. \"days\" means "
 "keep old files for a number of days. How many days is defined in key 'retain-"
 "days'"
-msgstr ""
+msgstr "Diese Einstellung bestimmt, was mit alten Protokoll- und "
+"Backup-Dateien geschieht:\n"
+"»Immer« bedeutet, daß alle alten Dateien behalten werden.\n"
+"»Nie« bedeutet, es werden keine log/Backup-Dateien behalten. "
+"Bei jeder Speicherung werden ältere Versionen gelöscht.\n"
+"»Tage« bedeutet, daß alte Dateien eine bestimmte Anzahl Tage aufbewahrt werden.\n"
+"Diese Zahl wird im Schlüssel »retain-days« gespeichert."
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:24
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:102
@@ -8021,7 +8050,7 @@ msgstr ""
 msgid ""
 "Set book option on new files to use split \"action\" field for \"Num\" field "
 "on registers/reports"
-msgstr "Setzt die Buchungsoption "
+msgstr ""
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:69
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:73
@@ -8233,9 +8262,8 @@ msgid "Show the calendar buttons Cancel, Today and Select."
 msgstr "Zeigt die Kalenderschaltflächen Abbrechen, Heute und Auswählen an"
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:99
-#, fuzzy
 msgid "Move the selection to the blank split on expand"
-msgstr "Gewählte Überweisungsvorlage eine Zeile nach oben umsortieren"
+msgstr "Bewege die Auswahl beim Erweitern in den leeren Buchungsteil"
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:100
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:168
@@ -8243,6 +8271,8 @@ msgid ""
 "This will move the selection to the blank split when the transaction is "
 "expanded."
 msgstr ""
+"Hierdurch wird die Auswahl in den leeren Buchungsteil bewegt, wenn die "
+"Buchung erweitert wird."
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:101
 msgid "Number of transactions to show in a register."
@@ -8287,18 +8317,19 @@ msgstr ""
 msgid "Use the system locale currency for all newly created reports."
 msgstr "Die systemweit voreingestellte Währung für neue Berichte benutzen."
 
+#Fixme: Source insert line breaks
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:108
-#, fuzzy
 msgid ""
 "This setting controls the default currency used for reports. If set to "
 "\"locale\" then GnuCash will retrieve the default currency from the user's "
 "locale setting. If set to \"other\", GnuCash will use the setting specified "
 "by the currency-other key."
 msgstr ""
-"Diese Einstellung gibt die Herkunft der voreingestellten Währung für neue "
-"Berichte an. Wenn auf »locale« gesetzt, verwendet GnuCash die "
-"voreingestellte Währung der Systemeinstellungen (locale). Wenn auf »other« "
-"gesetzt, wird die Einstellung von »currency_other« verwendet."
+"Diese Einstellung bestimmt die voreingestellten Währung für Berichte an.\n"
+"Ist »choice-locale« gewählt, verwendet GnuCash die voreingestellte Währung "
+"aus den Systemeinstellungen des Benutzers (locale). \n"
+"Ist aber »choice-other« gewählt, wird die Einstellung aus »currency_other« "
+"verwendet."
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:109
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:172
@@ -8339,7 +8370,14 @@ msgid ""
 "the filename-date-format setting. (Note: Any characters that are not allowed "
 "in filenames, such as '/', will be replaced with underscores '_' in the "
 "resulting file name.)"
-msgstr ""
+msgstr "Diese Einstellung bestimmt den Dateinamen für den PDF-Export. Dies "
+"ist eine »sprintf(3)« Zeichenkette mit drei Argumenten: »%1$s« ist der "
+"Berichtsname wie etwa »Rechnung«. »%2$s« ist die Nummer des Berichts, welche "
+"bei einer Rechnung die Rechnungsnummer ist. »%3$s« ist das Datum des "
+"Berichts, formatiert entsprechend der »filename-date-format«-Einstellung. "
+"(Anmerkung: Sämtliche Zeichen, die in Dateinamen nicht erlaubt sind, wie "
+"z.B. '/', werden durch Unterstriche »_«  im resultierenden Dateinamen "
+"ersetzt.)"
 
 #: ../src/gnome/gschemas/org.gnucash.gschema.xml.in.in.h:116
 msgid "PDF export file name date format choice"
@@ -8483,7 +8521,6 @@ msgid "Ending time period identifier"
 msgstr "Index für relativen Endzeitpunkt"
 
 #: ../src/gnome/gschemas/org.gnucash.window.pages.account.tree.gschema.xml.in.in.h:17
-#, fuzzy
 msgid ""
 "This setting controls the ending date set in profit/loss calculations if the "
 "end-choice setting is set to anything other than \"absolute\". This field "
@@ -8491,7 +8528,7 @@ msgid ""
 msgstr ""
 "Diese Einstellung setzt das Enddatum in den Einname-/Ausgabenrechnungen, "
 "wenn die Einstellung »end_choice« auf etwas anderes als »absolute« gesetzt "
-"ist. Dann wählt diese Einstellung eines der relativen Datumsvorgaben mit dem "
+"ist. Dann wählt diese Einstellung eine der relativen Datumsvorgaben mit dem "
 "jeweiligen Index von 0 bis 8."
 
 #: ../src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in.h:1
@@ -8502,7 +8539,8 @@ msgstr "Diese Spalte anzeigen?"
 msgid ""
 "This setting controls whether the given column will be visible in the view. "
 "TRUE means visible, FALSE means hidden."
-msgstr ""
+msgstr "Diese Einstellung bestimmt, ob die gegebene Spalte in der Ansicht "
+"sichtbar sein wird. »TRUE« bedeutet sichtbar und »FALSE« unsichtbar."
 
 #: ../src/gnome/gschemas/org.gnucash.window.pages.gschema.xml.in.in.h:3
 msgid "Width of this column"
@@ -8532,7 +8570,6 @@ msgid "Setup Account Period"
 msgstr "Buchführungsperioden einrichten"
 
 #: ../src/gnome/gtkbuilder/assistant-acct-period.glade.h:5
-#, fuzzy
 msgid ""
 "\n"
 "Select an accounting period and the closing date which must not be in the "
@@ -8541,9 +8578,12 @@ msgid ""
 "Books will be closed at midnight on the selected date."
 msgstr ""
 "\n"
-"Wählen Sie einen Buchungszeitraum und ein Abschlussdatum für diesen "
-"Zeitraum. Der Buchabschluss wird für Mitternacht jenes Datums gespeichert."
+"Wählen Sie einen Buchungszeitraum und das Abschlußdatum, welches größer als "
+"das des vorherigen Buches sein muß und nicht in der Zukunft liegen darf.\n"
+"\n"
+"Das Buch wird um Mitternacht des gewählten Datums geschlossen."
 
+# Fixme: I don't know, how to call the "Account Period Assistant"
 #: ../src/gnome/gtkbuilder/assistant-acct-period.glade.h:9
 msgid "xxx"
 msgstr "xxx"
@@ -8704,7 +8744,6 @@ msgid "Finish Account Setup"
 msgstr "Konteneinrichten fertigstellen"
 
 #: ../src/gnome/gtkbuilder/assistant-loan.glade.h:1
-#, fuzzy
 msgid ""
 "This is a step-by-step method for creating a loan repayment within GnuCash. "
 "In this assistant, you can input the details of your loan and its repayment "
@@ -8716,11 +8755,11 @@ msgid ""
 msgstr ""
 "Dieser Assistent ist eine Schritt-für-Schritt Anleitung, um die Rückzahlung "
 "eines Darlehens in GnuCash einzurichten. Sie können die Parameter Ihres "
-"Darlehens und der Rückzahlungsraten angeben. Mit diesen Informationen werden "
-"die entsprechenden Terminierten Buchungen erstellt.\n"
+"Darlehens und der Tilgungsraten angeben. Mit diesen Informationen werden "
+"die entsprechenden terminierten Buchungen erstellt.\n"
 "\n"
-"Wenn Sie einen Irrtum machen oder später Änderungen machen möchten, können "
-"Sie die erstellte Terminierte Buchung direkt ändern."
+"Wenn Ihnen ein Fehler unterläuft oder Sie später Änderungen vornehmen möchten, können "
+"Sie die erstellte terminierte Buchung direkt ändern."
 
 #: ../src/gnome/gtkbuilder/assistant-loan.glade.h:4
 msgid "Loan / Mortgage Repayment Setup"
@@ -8733,6 +8772,7 @@ msgstr ""
 "Geben Sie die Dahrlehensangaben ein. Es werden mindestens das Darlehenskonto "
 "und der Betrag benötigt.\n"
 
+# Fixme: Source without accelerator
 #: ../src/gnome/gtkbuilder/assistant-loan.glade.h:7
 msgid "Interest Rate:"
 msgstr "Zinssatz:"
@@ -8761,13 +8801,16 @@ msgstr "Darlehenskonto:"
 msgid ""
 "Enter the number of months still to be paid off. This determines both the "
 "remaining principle and the duration of the scheduled transaction."
-msgstr ""
+msgstr "Geben sie die Anzahl der Monate an, die noch getilgt werden müssen. "
+"Daraus resultiert sowohl der noch zu tilgende Betrag als auch die Dauer der "
+"terminierten Buchung."
 
 #: ../src/gnome/gtkbuilder/assistant-loan.glade.h:13
 msgid ""
 "Enter the annual interest rate in percent. Accepts values from 0.001 - 100. "
 "The Mortgage Assistant does not support zero-interest loans."
-msgstr ""
+msgstr "Geben SIe den jährlichen Zinssatz in Prozent ein. Akzeptiert werden "
+"Werte von 0,001 - 100. Dieser Assistent unterstützt keine Null-Zins Kredite."
 
 #: ../src/gnome/gtkbuilder/assistant-loan.glade.h:16
 #: ../src/gnome/gtkbuilder/dialog-fincalc.glade.h:16
@@ -10058,7 +10101,7 @@ msgstr "Datum _wählen:"
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:12
 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:28
 msgid "Toda_y"
-msgstr "_Heute"
+msgstr "H_eute"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:12
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:13
@@ -10076,7 +10119,7 @@ msgstr "Ende:"
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:15
 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:31
 msgid "C_hoose Date:"
-msgstr "Datum _wählen:"
+msgstr "Datum w_ählen:"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:15
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:16
@@ -10113,12 +10156,12 @@ msgstr "_Fixiert"
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:22
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:23
 msgid "Select _All"
-msgstr "Alle auswählen"
+msgstr "A_lle auswählen"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:24
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:25
 msgid "Sa_ve Filter"
-msgstr "Filter speichern"
+msgstr "Filter _speichern"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:25
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:51
@@ -10158,7 +10201,7 @@ msgstr "Sortiere nach Datum der Einträge"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:33
 msgid "S_tatement Date"
-msgstr "_Datum des Kontoauszugs:"
+msgstr "Datum des Kontoaus_zugs:"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:34
 msgid ""
@@ -10187,7 +10230,7 @@ msgstr "Sortieren nach Summe"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:39
 msgid "_Memo"
-msgstr "Buchungstext"
+msgstr "Buchungs_text"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:40
 #: ../src/report/standard-reports/transaction.scm:780
@@ -10211,7 +10254,7 @@ msgstr "Sortiere nach Aktionsfeld"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:45
 msgid "_Notes"
-msgstr "_Bemerkung"
+msgstr "Be_merkung"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:46
 msgid "Sort by notes field."
@@ -10219,15 +10262,16 @@ msgstr "Sortiere nach Bemerkungsfeld"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:47
 msgid "Sa_ve Sort Order"
-msgstr "Sortierreihenfolge speichern"
+msgstr "Sortierreihenfolge s_peichern"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:48
 msgid "Save the sort order for this register."
 msgstr "Sortierreihenfolge für diese Liste speichern"
 
+# Fixme: Source Accelerator missing
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:49
 msgid "Reverse Order"
-msgstr "Umgekehrte Reihenfolge"
+msgstr "_Umgekehrte Reihenfolge"
 
 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:50
 msgid "Sort in descending order."
@@ -10264,7 +10308,8 @@ msgstr "_Unterkonten einbeziehen"
 msgid ""
 "Include all descendant accounts in the reconcile. All of them must use the "
 "same commodity as this one."
-msgstr ""
+msgstr "Schließe alle Unterkonten in den Abgleich ein. Sie müssen alle in "
+"derselben Währung geführt werden wie dieses Konto."
 
 #: ../src/gnome/gtkbuilder/window-reconcile.glade.h:7
 #: ../src/gnome/window-reconcile2.c:763 ../src/gnome/window-reconcile.c:800
@@ -10275,7 +10320,7 @@ msgstr "Zahlung Haben_zins eingeben..."
 #: ../src/register/ledger-core/split-register-layout.c:690
 #: ../src/register/ledger-core/split-register-model.c:303
 msgid "Reconciled:R"
-msgstr "Reconciled:J"
+msgstr "Reconciled:A"
 
 #: ../src/gnome-search/dialog-search.c:239
 msgid "You must select an item from the list"
@@ -10302,7 +10347,8 @@ msgstr "Neuer Buchungsteil"
 msgid ""
 "Item represents an unknown object type (in the sense of bill, customer, "
 "invoice, transaction, split,...)|New item"
-msgstr ""
+msgstr "Item represents an unknown object type (in the sense of bill, customer, "
+"invoice, transaction, split,...)|Neues Element"
 
 #: ../src/gnome-search/dialog-search.c:1145
 msgid "all criteria are met"
@@ -10969,7 +11015,8 @@ msgstr "Sie können keine neue nationale Währung erstellen."
 #: ../src/gnome-utils/dialog-commodity.c:1286
 #, c-format
 msgid "%s is a reserved commodity type. Please use something else."
-msgstr ""
+msgstr "%s ist als Typ für Währungen oder Wertpapiere reserviert. "
+"Bitte verwenden Sie eine andere Bezeichnung."
 
 #: ../src/gnome-utils/dialog-commodity.c:1301
 msgid "That commodity already exists."
@@ -10983,11 +11030,11 @@ msgstr ""
 "Sie müssen in den Feldern »Voller Name«, »Symbol/Abkürzung« und »Typ« für "
 "die Devise/Wertpapier etwas angeben."
 
+# Fixme: Wo taucht das auf?
 #. The "date" and the "tnum" fields aren't being asked for, this is a split copy
 #: ../src/gnome-utils/dialog-dup-trans.c:235
-#, fuzzy
 msgid "Action/Number:"
-msgstr "_Nummer:"
+msgstr "Aktion/_Nummer:"
 
 #: ../src/gnome-utils/dialog-file-access.c:295
 msgid "Open..."
@@ -11887,7 +11934,7 @@ msgstr "Aktuelle Seite drucken"
 
 #: ../src/gnome-utils/gnc-main-window.c:282
 msgid "Pa_ge Setup..."
-msgstr "Seite _einrichten"
+msgstr "Seite ein_richten"
 
 #: ../src/gnome-utils/gnc-main-window.c:283
 msgid "Specify the page size and orientation for printing"
@@ -12321,13 +12368,13 @@ msgid ""
 "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?"
 msgstr ""
-"Die neue Buchung hat nicht genügend Informationen, gespeichert werden zu "
+"Die neue Buchung hat nicht genügend Informationen, um gespeichert werden zu "
 "können. Möchten Sie zur Bearbeitung der Buchung zurückkehren oder das "
 "Speichern abbrechen?"
 
 #: ../src/gnome-utils/gnc-tree-control-split-reg.c:1740
 msgid "_Return"
-msgstr "Kapitalertrag"
+msgstr "_Zurück"
 
 #: ../src/gnome-utils/gnc-tree-control-split-reg.c:1783
 #: ../src/register/ledger-core/split-register-control.c:1835
@@ -13809,13 +13856,14 @@ msgstr ""
 msgid "_Display symbol"
 msgstr "_Anzeigesymbol"
 
+# Fixme: Source
 #: ../src/gnome-utils/gtkbuilder/dialog-file-access.glade.h:1
 msgid "<b>Data Format:</b>"
 msgstr "<b>Dateiformat:</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-file-access.glade.h:2
 msgid "Open _Read-Only"
-msgstr "Schreib_geschützt öffnen"
+msgstr "_Schreibgeschützt öffnen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-file-access.glade.h:3
 msgid "<b>File</b>"
@@ -14118,9 +14166,11 @@ msgstr "Das Datumsformat aus den Systemeinstellungen übernehmen."
 msgid "Date/Time"
 msgstr "Datum und Zeit"
 
+# Fixme: Der Assistent ist derzeit unter Aktion->Kontenhierarchie hinzufügen
+# erreichbar. Können wir das vereinheitlichen?
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:70
 msgid "Perform account list _setup on new file"
-msgstr "Konteneinrichtung bei neuer Datei"
+msgstr "Konten_einrichtung bei neuer Datei"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:71
 msgid "Present the new account list dialog when you choose File -> New File."
@@ -14130,7 +14180,7 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:74
 msgid "Display \"_tip of the day\" dialog"
-msgstr "»Tipp des Tages« anzeigen"
+msgstr "»_Tipp des Tages« anzeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:75
 msgid "Display hints for using GnuCash at startup."
@@ -14179,7 +14229,7 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:86
 msgid "Display ne_gative amounts in red"
-msgstr "Negative Beträge in rot anzeigen"
+msgstr "Negative Beträge in _rot anzeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:87
 msgid "Display negative amounts in red."
@@ -14195,7 +14245,7 @@ msgstr "<b>Such-Dialog</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:90
 msgid "New search _limit:"
-msgstr "Ergebnisanzahl für Neue Suche:"
+msgstr "Ergebnisan_zahl für Neue Suche:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:91
 msgid "Default to 'new search' if fewer than this number of items is returned."
@@ -14221,7 +14271,7 @@ msgstr "Minuten"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:97
 msgid "Show auto-save confirmation _question"
-msgstr "Erklärung für automatisch Speichern anzeigen"
+msgstr "Erklärung für automatisch Speichern an_zeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:98
 msgid ""
@@ -14234,7 +14284,7 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:107
 msgid "Time to wait for answer:"
-msgstr "Wartezeit für Antwort:"
+msgstr "_Wartezeit für Antwort:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:109
 msgid "seconds"
@@ -14259,9 +14309,8 @@ msgid "Default _font:"
 msgstr "Voreingestellte _Schrift:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:115
-#, fuzzy
 msgid "The default check printing font."
-msgstr "Voreingestellte Schriftart zum Scheck drucken"
+msgstr "Die voreingestellte Schriftart zum Scheck drucken."
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:116
 msgid "Print _blocking chars"
@@ -14282,7 +14331,7 @@ msgstr "<b>Aktionen</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:120
 msgid "'_Enter' moves to blank transaction"
-msgstr "Mit 'Eingabe' gehen Sie zur leeren Buchung"
+msgstr "Mit »_Eingabe« gehen Sie zur leeren Buchung"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:121
 msgid ""
@@ -14290,12 +14339,12 @@ msgid ""
 "the bottom of the register. If clear, pressing the 'Enter' key will move "
 "down one row."
 msgstr ""
-"Wenn aktiviert, nach Drücken von 'Eingabe' zum leeren Buchungssatz gehen. "
-"Ansonsten nur eine Zeile nach unten gehen."
+"Wenn aktiviert, nach Drücken von »Eingabe« zum leeren Buchungssatz, "
+"ansonsten nur eine Zeile nach unten gehen."
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:122
 msgid "_Auto-raise lists"
-msgstr "Listen automatisch aufklappen"
+msgstr "_Listen automatisch aufklappen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:123
 msgid "Automatically raise the list of accounts or actions during input."
@@ -14308,7 +14357,7 @@ msgstr "<b>Kontenabgleich</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:125
 msgid "Check cleared _transactions"
-msgstr "Bestätigte Buchungen automatisch abgleichen"
+msgstr "_Bestätigte Buchungen automatisch abgleichen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:126
 msgid "Pre-check cleared transactions when creating a reconcile dialog."
@@ -14332,7 +14381,7 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:131
 msgid "Always reconcile to t_oday"
-msgstr "Immer zum heutigen Datum abgleichen"
+msgstr "Immer zum heutigen _Datum abgleichen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:132
 msgid ""
@@ -14350,9 +14399,10 @@ msgstr "_Vertikale Linien zwischen Spalten zeichnen"
 msgid "Show vertical borders on the cells."
 msgstr "Vertikale Begrenzungen anzeigen."
 
+# H und C sind in diesem Dialog durch Hilfe und Schließen belegt
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:135
 msgid "Draw hori_zontal lines between rows"
-msgstr "_Horizontale Linien zwischen Zeilen zeichnen"
+msgstr "H_orizontale Linien zwischen Zeilen zeichnen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:136
 msgid "Show horizontal borders on the cells."
@@ -14360,7 +14410,7 @@ msgstr "Horizontale Begrenzungen anzeigen."
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:137
 msgid "Double _mode colors alternate with transactions"
-msgstr "Zweizeilenstil: Farben abwechselnd pro Buchungssatz"
+msgstr "_Zweizeilenstil: Farben abwechselnd pro Buchungssatz"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:138
 msgid ""
@@ -14372,13 +14422,14 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:139
 msgid "Don't _use GnuCash built-in colors"
-msgstr "Benutzt nicht die GnuCash-eigenen Farben"
+msgstr "Benutzt nicht die GnuCash-eigenen _Farben"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:140
 msgid ""
 "GnuCash uses a yellow/green theme by default for register windows. Check "
 "this if you want to use the system color theme instead."
-msgstr ""
+msgstr "Gnucash verwendet in der Kontenansicht normalerweise ein gelb/grünes "
+"Farbthema. Wenn aktiviert, wird stattdessen das systemeigene Thema verwendet."
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:141
 msgid "<b>Graphics</b>"
@@ -14386,7 +14437,7 @@ msgstr "<b>Grafik</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:142
 msgid "Tab order in_cludes Transfer on Memorised Transactions"
-msgstr "Bei Auto-Vervollständigen zum Gegenkonto-Feld weitergehen"
+msgstr "Bei Auto-Vervollständigen zum _Gegenkonto-Feld weitergehen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:143
 msgid "Move to Transfer field when memorised transaction auto filled."
@@ -14410,7 +14461,7 @@ msgstr "_Aktive vollständig"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:153
 msgid "Number of _transactions:"
-msgstr "Anzahl Buchungen:"
+msgstr "An_zahl Buchungen:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:155
 msgid "_Double line mode"
@@ -14426,7 +14477,7 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:157
 msgid "Register opens in a new _window"
-msgstr "Kontobuch in neuem Fenster öffnen"
+msgstr "Kontobuch in neuem _Fenster öffnen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:158
 msgid ""
@@ -14455,26 +14506,26 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:161
 msgid "Number of _characters for auto complete:"
-msgstr "Anzahl Buchstaben für Auto-Vervollständigen:"
+msgstr "Anzahl Buchstaben für Auto-Vervo_llständigen:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:163
 msgid "Show the _entered and reconcile dates"
-msgstr "Datum der _Eingabe und Abgleichen anzeigen"
+msgstr "Datum von _Eingabe und Abgleich anzeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:165
 msgid "Show the calendar b_uttons"
-msgstr "Kalender-Knöpfe anzeigen"
+msgstr "_Kalender-Knöpfe anzeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:167
 msgid "_Move the selection to the blank split on expand"
 msgstr ""
-"Mit dem Cursor zum neuen Buchungsteil springen, wenn eine Buchung "
+"Mit dem Cursor zum _neuen Buchungsteil springen, wenn eine Buchung "
 "ausgeklappt wird"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:169
 msgid "_Show entered and reconciled dates on selection"
 msgstr ""
-"Datum der Eingabe und des Abgleichens bei ausgewählter Buchung anzeigen"
+"_Datum der Eingabe und des Abgleichens bei der Ausgewahl anzeigen"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:171
 msgid "Register Defaults"
@@ -14797,7 +14848,7 @@ msgstr "ISO (2001-12-31)"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:19
 msgid "UTC - Coordinated Universal Time"
-msgstr ""
+msgstr "UTC - Koordinierte Weltzeit"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:21
 msgid "No Fancy Date Format"
@@ -15231,11 +15282,11 @@ msgstr ""
 
 #: ../src/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade.h:2
 msgid "Only show _active owners"
-msgstr "Nur _aktive Mandanten zeigen"
+msgstr "Nur _aktive Partner zeigen"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-tree-view-owner.glade.h:3
 msgid "Show _zero balance owners"
-msgstr "Nullsalden anzeigen"
+msgstr "Partner mit _Nullsalden anzeigen"
 
 #: ../src/gnome-utils/window-main-summarybar.c:298
 #, c-format
@@ -15762,9 +15813,8 @@ msgid "Confirm Password:"
 msgstr "Passwort bestätigen:"
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:21
-#, fuzzy
 msgid "Remember the _PIN in memory"
-msgstr "HBCI PIN im Speicher merken"
+msgstr "HBCI _PIN im Speicher merken"
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:22
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:6
@@ -15796,9 +15846,8 @@ msgstr ""
 "AqBanking-Import beendet ist. Andernfalls bleibt das Fenster geöffnet."
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:26
-#, fuzzy
 msgid "Use Non-SWIFT _transaction text"
-msgstr "Verwende das dem Buchungsdatum nächste Datum."
+msgstr "Verwende _Nicht-SWIFT Buchungstext"
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:27
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:8
@@ -15807,7 +15856,10 @@ msgid ""
 "the MT940 file. Normally GNUcash ignores this text. However by activating "
 "this option, the transaction text is used for the transaction description "
 "too."
-msgstr ""
+msgstr "Einige Banken fügen Teile des Buchungsbeschreibung als »transaction "
+"text« in MT940 Dateien ein. Normalerweise ignoriert GnuCash diesen Text. "
+"Durch Aktivierung dieser Option wird der »transaction text« zur "
+"Buchungsbeschreibung hinzugefügt."
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:28
 msgid "_Verbose debug messages"
@@ -15991,25 +16043,24 @@ msgid "Credited Account Bank Code"
 msgstr "BLZ des Auftraggebers"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:404
-#, fuzzy
 msgid "Enter a SEPA Online Direct Debit Note"
-msgstr "Online-Lastschrift eingeben"
+msgstr "SEPA Online-Lastschrift eingeben"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:409
 msgid "Debited IBAN (International Account Number)"
-msgstr "IBAN des Zahlungspflichtigen"
+msgstr "IBAN (International Account Number) des Zahlungspflichtigen"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:411
 msgid "Debited BIC (Bank Code)"
-msgstr "BIC des Zahlungspflichtigen"
+msgstr "BIC (SWIFT Bankkennzahl) des Zahlungspflichtigen"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:416
 msgid "Credited IBAN (International Account Number)"
-msgstr "IBAN des Zahlungsempfängers"
+msgstr "IBAN (International Account Number) des Zahlungsempfängers"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:418
 msgid "Credited BIC (Bank Code)"
-msgstr "BIC des Zahlungsempfängers"
+msgstr "BIC (SWIFT Bankkennzahl) des Zahlungsempfängers"
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:497
 #, c-format
@@ -16091,6 +16142,7 @@ msgstr ""
 "Sie haben keinen Verwendungszweck eingegeben. Für einen Überweisungsauftrag "
 "ist die Eingabe eines Verwendungszwecks erforderlich.\n"
 
+# Fixme: aktuellen Stand prüfen.
 #: ../src/import-export/aqb/dialog-ab-trans.c:718
 msgid ""
 "The text you entered contained at least one character that is invalid for a "
@@ -16100,7 +16152,13 @@ msgid ""
 "\n"
 "In particular, neither Umlauts nor an ampersand (&) is allowed, neither in "
 "the recipient or sender name nor in any purpose line."
-msgstr ""
+msgstr "Ihr eingegebener Text enthält mindestens ein Zeichen, das in einer "
+"SEPA-Überweisung ungültig sein kann. In der Basisversion unterstützt SEPA "
+"leider nur: a...z, A...Z, 0...9, und die folgenden Satzzeichen: "
+"' : ? , - ( + . ) / \n"
+"\n"
+"Insbesondere sind weder Umlaute, noch Et-Zeichen »&« erlaubt, weder im "
+"Sender- noch im Empfängernamen, geschweige denn im Verwendungszweck."
 
 #: ../src/import-export/aqb/dialog-ab-trans.c:1183
 msgid ""
@@ -16521,11 +16579,9 @@ msgid "Remember the PIN in memory"
 msgstr "HBCI PIN im Speicher merken"
 
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:7
-#, fuzzy
 msgid "Put the transaction text in front of the purpose of a transaction."
 msgstr ""
-"Alle Buchungssätze außer dem aktuellen einzeilig anzeigen. Den aktuellen "
-"Buchungssatz vollständig anzeigen."
+"Den »transaction text« vor dem Verwendungszweck einfügen."
 
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:9
 msgid "Verbose HBCI debug messages"
@@ -16709,7 +16765,8 @@ msgstr "Export-Einstellungen"
 
 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:13
 msgid "Select the accounts to be exported and date range if required."
-msgstr ""
+msgstr "Wählen Sie die Konten für den Export, sowie den Zeitraum, sofern "
+"gewünscht."
 
 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:22
 msgid "<b>_Dates</b>"
@@ -16737,7 +16794,8 @@ msgstr "Wählen Sie einen Dateinamen für den Export"
 msgid ""
 "Press Apply to create export file.\n"
 "Cancel to abort."
-msgstr ""
+msgstr "Drücken Sie »Anwenden«, um die Export-Datei zu erstellen,\n"
+"oder »Abbrechen«, um den Vorgang abzubrechen."
 
 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:40
 msgid "Export Now..."
@@ -16757,33 +16815,32 @@ msgstr "Kategorie"
 
 #: ../src/import-export/csv-exp/csv-transactions-export.c:424
 msgid "To With Sym"
-msgstr ""
+msgstr "Nach m. Währung"
 
 #: ../src/import-export/csv-exp/csv-transactions-export.c:424
 msgid "From With Sym"
-msgstr ""
+msgstr "Von m. Währung"
 
 #: ../src/import-export/csv-exp/csv-transactions-export.c:425
 msgid "To Num."
-msgstr "Bis Nr."
+msgstr "Nach numerisch"
 
 #: ../src/import-export/csv-exp/csv-transactions-export.c:425
 msgid "From Num."
-msgstr "Von Nr."
+msgstr "Von numerisch"
 
-# strange, had fuzzy translation Saldo (Periodenbezogen)
 #: ../src/import-export/csv-exp/csv-transactions-export.c:426
 msgid "To Rate/Price"
-msgstr "Zu Kurs/Preis"
+msgstr "Nach Kurs"
 
 #: ../src/import-export/csv-exp/csv-transactions-export.c:426
 msgid "From Rate/Price"
-msgstr "Von Kurs/Preis"
+msgstr "Von Kurs"
 
 #. Header string, 'eol = end of line marker'
 #: ../src/import-export/csv-exp/csv-tree-export.c:155
 msgid "type"
-msgstr ""
+msgstr "Typ"
 
 #: ../src/import-export/csv-exp/csv-tree-export.c:155
 msgid "full_name"
@@ -16825,13 +16882,14 @@ msgstr "Versteckt"
 msgid "tax"
 msgstr "Steuerrelevant"
 
+# Fixme: Source should be changed
 #: ../src/import-export/csv-exp/csv-tree-export.c:158
 msgid "place_holder"
 msgstr "Platzhalter"
 
 #: ../src/import-export/csv-exp/gnc-plugin-csv-export.c:47
 msgid "Export Account T_ree to CSV..."
-msgstr "_Kontenhierarchie nach CSV exportieren ..."
+msgstr "Konten_hierarchie nach CSV exportieren ..."
 
 #: ../src/import-export/csv-exp/gnc-plugin-csv-export.c:48
 msgid "Export the Account Tree to a CSV file"
@@ -16860,7 +16918,12 @@ msgid ""
 "\n"
 "You can also go back and verify your selections by clicking on 'Back' or "
 "'Cancel' to Abort Import.\n"
-msgstr ""
+msgstr "Wenn Sie auf »Anwenden« drücken, werden die Konten aus der Datei »%s« "
+"importiert.\n"
+"\n"
+"Sie können aber auch zurückgehen und ihre Angaben überprüfen, wenn sie auf "
+"»Zurück« drücken oder den Vorgang ganz abbrechen, indem Sie auf »Abbrechen« "
+"drücken.\n" 
 
 #: ../src/import-export/csv-imp/assistant-csv-account-import.c:75
 #, c-format
@@ -16874,7 +16937,18 @@ msgid ""
 "for setting book options, since these can affect how imported data are "
 "converted to GnuCash transactions. If this is an existing file, the dialog "
 "will not be shown.\n"
-msgstr ""
+msgstr "Wenn Sie auf »Anwenden« drücken, werden die Konten aus der Datei »%s« "
+"importiert.\n"
+"\n"
+"Sie können aber auch zurückgehen und ihre Angaben überprüfen, wenn sie auf "
+"»Zurück« drücken oder den Vorgang ganz abbrechen, indem Sie auf »Abbrechen« "
+"drücken.\n" 
+"\n"
+"Wenn dies Ihr erster Import in eine neue Datei ist, werden Sie zunächst "
+"einen Dialog zum Setzen der Buch-Eigenschaften sehen, da diese die Art und "
+"Weise beeinflussen können, wie Ihre importierten Daten in GnuCash Buchungen "
+"konvertiert werden. Falls diese Datei bereits existierte, wird der Dialog "
+"nicht mehr angezeigt.\n"
 
 #: ../src/import-export/csv-imp/assistant-csv-account-import.c:172
 #: ../src/plugins/bi_import/dialog-bi-import-gui.c:218
@@ -17070,24 +17144,24 @@ msgid ""
 "To Change the account, double click on the required account, click Forward "
 "to proceed."
 msgstr ""
-"Um das KOnto zu wechseln, doppleklicken Sie auf das gewünschte Konto, dann "
+"Um ein Konto zu auszutauschen, doppelklicken Sie auf das gewünschte Konto, dann "
+"»Vorwärts«, um fortzufahren."
 
 #. A list of the transactions we create
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.c:1520
 msgid "Double click on rows to change, then click on Apply to Import"
-msgstr ""
+msgstr "Doppelklicken Sie auf Zeilen für Änderungen, danach klicken Sie »Anwenden« zum Import."
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.c:1568
-#, fuzzy, c-format
+#, c-format
 msgid "The transactions were imported from the file '%s'."
-msgstr "Beim Lesen der Datei »%s« ist ein Fehler aufgetreten."
+msgstr "Die Buchungen wurden aus der Datei »%s« importiert."
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:1
 msgid "CSV Transaction Import"
 msgstr "CSV-Buchungen-Import"
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:2
-#, fuzzy
 msgid ""
 "This assistant will help you import a delimited file containing a list of "
 "transactions.\n"
@@ -17105,8 +17179,8 @@ msgid ""
 "have some header text, a points collected status row or multiple accounts in "
 "the same file."
 msgstr ""
-"Dieser Assistent möchte Ihnen helfen, Textdateien mit Buchungen zu "
-"importieren.\n"
+"Dieser Assistent möchte Ihnen helfen, Buchungen aus einer Textdateie mit "
+"Trennzeichen zu importieren.\n"
 "\n"
 "Alle importierten Buchungen eines Imports werden mit einem bestimmten Konto "
 "pro Import assoziiert. Wenn Sie eine Kontospalte wählen wird das Konto aus "
@@ -17117,8 +17191,9 @@ msgstr ""
 "auf den Balken über den dargestellten Zeilen, um die Breite festzulegen.\n"
 "\n"
 "Schließlich gibt es eine Option zur Bestimmung der ersten und letzten Zeile, "
-"welche benutzt werden kann, wenn sie einige Kopfzeilen oder mehrere Konten "
-"in einer Datei haben."
+"sowie eine Option Zeilen abwechselnd zu überspringen. Diese Optionen können "
+"benutzt werden, wenn sie einige Kopfzeilen oder mehrere Konten in einer "
+"Datei haben."
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:9
 msgid "Transaction Import Assistant"
@@ -17146,7 +17221,7 @@ msgstr " und stoppe auf Zeile "
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:16
 msgid "Skip alternate rows from the start row"
-msgstr ""
+msgstr "Ãœberspringe abwechseld Zeilen ab der Startzeile"
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:17
 msgid "Data type: "
@@ -17196,6 +17271,7 @@ msgstr "Vorschau-Einstellungen"
 msgid "Error text."
 msgstr "Fehlertext"
 
+# Fixme: Source should be more precise "in this file"
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:36
 msgid ""
 "On the following page you will be able to associate each transaction to a "
@@ -17213,7 +17289,23 @@ msgid ""
 "The confidence of a correct association is displayed as a colored bar.\n"
 "\n"
 "More information can be displayed by using the help button."
-msgstr ""
+msgstr "Auf der folgenden Seite haben Sie die Möglicjkeit, jeder Buchung eine "
+"Kategorie zuzuordnen.\n"
+"\n"
+"Wenn dies ihr erster Import in diese Datei ist, müssen Sie leider alle "
+"Zeilen manuell zuordnen. Bei späteren Importen wird das Import-Modul "
+"versuchen, die Zuordnung basierend auf den früheren Importen vorzunehmen.\n" 
+"\n"
+"Wenn dies Ihr erster Import in eine neue Datei ist, werden Sie zunächst "
+"einen Dialog zum Setzen der Buch-Eigenschaften sehen, da diese die Art und "
+"Weise beeinflussen können, wie Ihre importierten Daten in GnuCash Buchungen "
+"konvertiert werden. Falls diese Datei bereits existierte, wird der Dialog "
+"nicht mehr angezeigt.\n"
+"\n"
+"Die Zuverlässigkeit der korrekten Zuordnung wird durch einen farbigen Balken "
+"angezeigt.\n" 
+"\n"
+"Weitere Informationen sind über den »Hilfe«-Knopf abrufbar."
 
 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:45
 msgid "Transaction Information"
@@ -17408,23 +17500,23 @@ msgstr ""
 
 #: ../src/import-export/dialog-import.glade.h:16
 msgid "Commercial ATM _fees threshold"
-msgstr "Auszahlungsgebühren"
+msgstr "Aus_zahlungsgebühren"
 
 #: ../src/import-export/dialog-import.glade.h:17
 msgid "Auto-c_lear threshold"
-msgstr "Entscheidungsschwelle für automatisches Abgleichen"
+msgstr "Entscheidungsschwelle für automatisches Abg_leichen"
 
 #: ../src/import-export/dialog-import.glade.h:18
 msgid "Auto-_add threshold"
-msgstr "Entscheidungsschwelle für automatisches Hinzufügen"
+msgstr "Entscheidungsschwelle für automatisches Hinzu_fügen"
 
 #: ../src/import-export/dialog-import.glade.h:19
 msgid "Match _display threshold"
-msgstr "Entscheidungsschwelle für Anzeige in Zuordnung"
+msgstr "Entscheidungsschwelle für Anzeige in Zu_ordnung"
 
 #: ../src/import-export/dialog-import.glade.h:20
 msgid "Use _bayesian matching"
-msgstr "_Bayes-Algorithmus verwenden"
+msgstr "Ba_yes-Algorithmus verwenden"
 
 #: ../src/import-export/dialog-import.glade.h:21
 msgid ""
@@ -17454,14 +17546,14 @@ msgstr ""
 msgid "Select matching existing transaction"
 msgstr "Wählen Sie die zugeordnete, schon existierende Buchung"
 
+#Fixme: Source accelerator missing
 #: ../src/import-export/dialog-import.glade.h:25
-#, fuzzy
 msgid "Show Reconciled"
-msgstr "Abgeglichen"
+msgstr "Abgeglichene anzeigen"
 
 #: ../src/import-export/dialog-import.glade.h:26
 msgid "Imported transaction's first split:"
-msgstr "Erster Teil der importierten Buchung"
+msgstr "Erster Teil der importierten Buchung:"
 
 #: ../src/import-export/dialog-import.glade.h:27
 msgid "Potential splits matching the selected transaction: "
@@ -17479,7 +17571,8 @@ msgstr ""
 msgid ""
 "This transaction will be imported balanced (you may still want to double "
 "check the match or destination account)."
-msgstr "Diese Buchung wird ausgeglichen importiert."
+msgstr "Diese Buchung wird ausgeglichen importiert. Überprüfen Sie trotzdem "
+"die Zuordnung und das Gegenkonto."
 
 #: ../src/import-export/dialog-import.glade.h:30
 msgid "This transaction requires your intervention or it will NOT be imported."
@@ -17647,15 +17740,15 @@ msgstr ""
 "zusätzlichen Auszahlungsgebühren in Ihrer lokalen Währung angeben."
 
 #: ../src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in.h:19
-#, fuzzy
 msgid "Display or hide reconciled matches"
-msgstr "Anzeigen des Abgleich-Datums?"
+msgstr "Anzeigen oder verbergen abgeglichener Treffer"
 
 #: ../src/import-export/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in.in.h:20
 msgid ""
 "Shows or hides transactions from the match picker which are already of some "
 "reconciled state."
-msgstr ""
+msgstr "Zeigt oder verbirgt Buchungen, welche vom Programm bereits als "
+"einander entsprechend betrachtet werden."
 
 #: ../src/import-export/import-account-matcher.c:118
 msgid "Account ID"
@@ -17772,19 +17865,17 @@ msgid "Confidence"
 msgstr "Genauigkeit"
 
 #: ../src/import-export/import-match-picker.c:438
-#, fuzzy
 msgid "Pending Action"
-msgstr "_Online Aktionen"
+msgstr "Ausstehende Aktion"
 
 #: ../src/import-export/import-pending-matches.c:194
-#, fuzzy
 msgid "Manual"
-msgstr "Jährlich"
+msgstr "Manuell"
 
 #: ../src/import-export/import-pending-matches.c:196
 #: ../src/report/business-reports/balsheet-eg.scm:332
 msgid "Auto"
-msgstr "automatisch"
+msgstr "Automatisch"
 
 #: ../src/import-export/log-replay/gnc-log-replay.c:570
 msgid "Select a .log file to replay"
@@ -17818,12 +17909,12 @@ msgstr ""
 
 #: ../src/import-export/log-replay/gnc-plugin-log-replay.c:48
 msgid "_Replay GnuCash .log file..."
-msgstr "Einträge aus Logdatei abspielen..."
+msgstr "Einträge aus _Logdatei einspielen..."
 
 #: ../src/import-export/log-replay/gnc-plugin-log-replay.c:49
 msgid "Replay a GnuCash log file after a crash. This cannot be undone."
 msgstr ""
-"Einträge aus Logdatei nach einem Programmabsturz abspielen. Dies kann nicht "
+"Einträge aus Logdatei nach einem Programmabsturz einspielen. Dies kann nicht "
 "rückgängig gemacht werden."
 
 #. As we now have the commodity, select the account with that commodity.
@@ -18020,7 +18111,7 @@ msgid ""
 "are no errors or warnings, you will automatically proceed to the next step. "
 "Otherwise, the details will be shown below for your review."
 msgstr ""
-"Sobald Sie den »Vor«-Knopf drücken, wird GnuCash Ihre QIF-Datei laden. Wenn "
+"Sobald Sie den »Start«-Knopf drücken, wird GnuCash Ihre QIF-Datei laden. Wenn "
 "dabei keine Fehler oder Warnungen auftreten, kommt der nächste Schritt. "
 "Andernfalls werden die Meldungen unten angezeigt."
 
@@ -18146,9 +18237,10 @@ msgstr ""
 "Sie können so viele Dateien laden, wie Sie möchten. Es ist also kein "
 "Problem, falls sich Ihre Daten in mehreren Dateien befinden.\n"
 
+# A ist bereits durch _Abbrechen in den Dialogen belegt
 #: ../src/import-export/qif-imp/assistant-qif-import.glade.h:12
 msgid "_Select..."
-msgstr "_Auswählen..."
+msgstr "Aus_wählen..."
 
 #: ../src/import-export/qif-imp/assistant-qif-import.glade.h:13
 msgid "Select a QIF file to load"
@@ -18477,7 +18569,7 @@ msgstr "_Importierte Buchungen, die durchgesehen werden müssen:"
 
 #: ../src/import-export/qif-imp/assistant-qif-import.glade.h:77
 msgid "_Possible matches for the selected transaction:"
-msgstr "Mögliche Duplikate für ausgewählte neue Buchungen"
+msgstr "Mögliche _Duplikate für ausgewählte neue Buchung:"
 
 #: ../src/import-export/qif-imp/assistant-qif-import.glade.h:78
 msgid "Select possible duplicates"
@@ -18585,7 +18677,7 @@ msgstr ""
 
 #: ../src/import-export/qif-imp/dialog-account-picker.glade.h:13
 msgid "_Select or add a GnuCash account:"
-msgstr "Auswählen oder Hinzufügen eines GnuCash Kontos"
+msgstr "Aus_wählen oder Hinzufügen eines GnuCash Kontos"
 
 #: ../src/import-export/qif-imp/gnc-plugin-qif-import.c:47
 msgid "Import _QIF..."
@@ -18924,7 +19016,7 @@ msgstr "Diese Zeilen wurden beim Importieren ignoriert"
 
 #: ../src/plugins/bi_import/gnc-plugin-bi-import.c:57
 msgid "Import Bills & Invoices..."
-msgstr "Rechnungen importieren..."
+msgstr "_Rechnungen importieren..."
 
 #: ../src/plugins/bi_import/gnc-plugin-bi-import.c:57
 msgid "Import bills and invoices from a CSV text file"
@@ -19033,15 +19125,18 @@ msgstr ""
 "   %u %s neu angelegt\n"
 "   %u %s aktualisiert (gemäß ID)"
 
+# Fixme: Source
 #. Menu Items
 #: ../src/plugins/customer_import/gnc-plugin-customer_import.c:56
 msgid "I_mport"
 msgstr "I_mport"
 
+# Fixme: Source
 #: ../src/plugins/customer_import/gnc-plugin-customer_import.c:57
 msgid "Import Customers and Vendors"
-msgstr "Importiert Kunden und Lieferanten"
+msgstr "Importiert K_unden und Lieferanten"
 
+# Fixme: Source
 #: ../src/plugins/customer_import/gnc-plugin-customer_import.c:57
 msgid "customer_import tooltip"
 msgstr ""
@@ -19071,7 +19166,6 @@ msgid "<b>3. Select import options</b>"
 msgstr "<b>3. Bestimmen Sie die Importoptionen</b>"
 
 #: ../src/plugins/customer_import/gtkbuilder/dialog-customer-import-gui.glade.h:14
-#, fuzzy
 msgid "<b>4. Preview</b>"
 msgstr "<b>4. Vorschau</b>"
 
@@ -19162,9 +19256,8 @@ msgstr "sample:Beschreibungsbeispiel einer Buchung"
 
 #: ../src/register/ledger-core/split-register-layout.c:698
 #: ../src/register/ledger-core/split-register-model.c:325
-#, fuzzy
 msgid "Associate:A"
-msgstr "Datei zuordnen"
+msgstr "Associate:Z"
 
 #: ../src/register/ledger-core/split-register-layout.c:706
 #: ../src/register/ledger-core/split-register-layout.c:746
@@ -20164,9 +20257,10 @@ msgstr ""
 "Keine gültige %s gewählt. Klicken Sie auf »Optionen«, um eine Firma zu "
 "wählen."
 
+# Fixme: Source Accelerator missing
 #: ../src/report/business-reports/customer-summary.scm:1031
 msgid "Customer Summary"
-msgstr "Kundenübersicht"
+msgstr "Kundenüber_sicht"
 
 #: ../src/report/business-reports/easy-invoice.scm:114
 #: ../src/report/business-reports/easy-invoice.scm:259
@@ -21513,15 +21607,15 @@ msgstr "Spalten"
 
 #: ../src/report/report-gnome/dialog-report.glade.h:1
 msgid "<b>A_vailable reports</b>"
-msgstr "<b>Verfügbare Berichte</b>"
+msgstr "<b>_Verfügbare Berichte</b>"
 
 #: ../src/report/report-gnome/dialog-report.glade.h:2
 msgid "<b>_Selected Reports</b>"
-msgstr "<b>Gewählte Berichte</b>"
+msgstr "<b>_Gewählte Berichte</b>"
 
 #: ../src/report/report-gnome/dialog-report.glade.h:3
 msgid "A_dd  >>"
-msgstr "Hinzufügen >>"
+msgstr "Hin_zufügen >>"
 
 #: ../src/report/report-gnome/dialog-report.glade.h:4
 msgid "<< _Remove"
@@ -22276,13 +22370,17 @@ msgstr ""
 "Zeige Zwischensummen für übergeordnete Konten gemäß Rechnungswesen-Stil "
 "eingerückt an. (experimentell)."
 
+# Hier ausnahmsweise "Aktiva & Passiva", die Seiten der Bilanz, 
+# da sich auch die Reinvermögen-Berichte darin befinden
 #: ../src/report/report-system/report.scm:65
 msgid "_Assets & Liabilities"
-msgstr "_Aktiva & Verbindlichkeiten"
+msgstr "_Aktiva & Passiva"
 
+# Fell: im Deutschen ist "Aufwand & Ertrag"
+# neben "Gewinn & Verust (GuV)" gebräuchlicher
 #: ../src/report/report-system/report.scm:66
 msgid "_Income & Expense"
-msgstr "_Ertrag & Aufwand"
+msgstr "Aufwand & _Ertrag"
 
 #: ../src/report/report-system/report.scm:68
 msgid "_Taxes"
@@ -22919,7 +23017,7 @@ msgstr ""
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:96
 msgid "LIFO"
-msgstr ""
+msgstr "LiFo"
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:97
 msgid "Use last-in first-out method for basis."
@@ -22935,24 +23033,26 @@ msgstr ""
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:109
 msgid "How to report commissions and other brokerage fees."
-msgstr ""
+msgstr "Wie sollen Kommissionen und andere Vermittlungsgebühren berücksichtigt "
+"werden?"
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:111
 msgid "Include in basis"
-msgstr "Schließt Bemessungsgrundlage ein"
+msgstr "In Bemessungsgrundlage einschließen"
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:112
 msgid "Include brokerage fees in the basis for the asset."
-msgstr "Schließt die Maklergebühr in die Basis für den Gewinn ein."
+msgstr "Schließt die Vermittlungsgebühren als Beschaffungskosten in die Basis "
+"der Anlage ein."
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:114
 msgid "Include in gain"
-msgstr "Schließt Gewinn ein"
+msgstr "Im Ertrag berücksichtigen"
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:115
 msgid "Include brokerage fees in the gain and loss but not in the basis."
 msgstr ""
-"Schließt Maklergebührt in Gewinn und Verlust ein, aber nicht in der "
+"Schließe Vermittlungsgebühren in Gewinn und Verlust ein, aber nicht in der "
 "Bemessungsgrundlage."
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:117
@@ -23058,7 +23158,8 @@ msgstr ""
 
 #: ../src/report/standard-reports/advanced-portfolio.scm:1183
 msgid "** this commodity has no price and a price of 1 has been used."
-msgstr ""
+msgstr "** dieses Wertpapier hat keinen Kurs hinterlegt, daher wird dafür 1 "
+"verwendet."
 
 #: ../src/report/standard-reports/average-balance.scm:36
 msgid "Average Balance"
@@ -23708,9 +23809,8 @@ msgid "Cash Flow"
 msgstr "Kapitalfluss"
 
 #: ../src/report/standard-reports/cash-flow.scm:57
-#, fuzzy
 msgid "Include Trading Accounts in report"
-msgstr "Summe Devisenhandel anzeigen"
+msgstr "Handelskonten in den Bericht einschließen"
 
 #: ../src/report/standard-reports/cash-flow.scm:106
 msgid "Include transfers to and from Trading Accounts in the report."
@@ -24521,10 +24621,10 @@ msgstr ""
 "Formatiert die Tabelle passend zum Kopieren/Einfügen mit zusätzlichen "
 "Tabellenzellen."
 
+# Fixme: da gibt es bestimmt was Schöneres...
 #: ../src/report/standard-reports/transaction.scm:665
-#, fuzzy
 msgid "Account Substring"
-msgstr "Kontenauswahl"
+msgstr "Teilzeichenkette Konto"
 
 #: ../src/report/standard-reports/transaction.scm:671
 msgid "Filter on these accounts."
@@ -25850,7 +25950,8 @@ msgstr "Keine Hilfe verfügbar."
 #: ../src/gnome/gnucash.appdata.xml.in.h:1
 msgid ""
 "GnuCash is a program for personal and small-business financial-accounting."
-msgstr ""
+msgstr "GnuCash ist ein Buchhaltungsprogramm Privatpersonen und kleine "
+"Unternehmen."
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:2
 msgid ""
@@ -25859,40 +25960,46 @@ msgid ""
 "use as a checkbook register, it is based on professional accounting "
 "principles like double-entry accounting to ensure balanced books and "
 "accurate reports."
-msgstr ""
+msgstr "Enworfen, um einfach im Gebrauch zu sein, aber mächtig und flexibel, "
+"erlaubt GnuCash Ihnen den Überblick über Ihre Bankkonten wie Wertpapiere, "
+"Einkünte wie Aufwendungen zu behalten. So intuitiv und schnell zu benutzen "
+" wie ein Scheckbuchregister basiert es auf professionellen Prinzipien wie "
+"der doppelten Buchführung um ausgeglichene Bücher und präzise Berichte zu "
+"gewährleisten."
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:3
 msgid "With GnuCash you can (but are not limited to):"
-msgstr ""
+msgstr "Mit GnuCash können Sie neben Anderem:"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:4
 msgid "Keep track of your day to day personal income and expenses"
-msgstr ""
+msgstr "Die Übersicht über Ihre täglichen persönlichen Einnahmen und Ausgaben bewahren"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:5
 msgid "Manage your stock, bond and mutual fund accounts with ease"
-msgstr ""
+msgstr "Mit Leichtigkeit ihre Renten, Aktien und Fonds verwalten"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:6
 msgid "Keep your small business' accounting up to date"
-msgstr "Behalten Sie Ihre Buchhaltung aktuell"
+msgstr "Ihre kleine Geschäftsbuchhaltung auf dem Laufenden halten"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:7
 msgid "Create accurate reports and graphs from your financial data"
-msgstr ""
+msgstr "Präzise Berichte ind Grafiken ihrer Finanzdaten erzeugen"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:8
 msgid "Set up scheduled transactions to avoid repeated data entry"
 msgstr ""
 "Terminierte Buchungen einrichten, um wiederholte Dateneingabe zu vermeiden"
 
+# Fixme: expand Source
 #: ../src/gnome/gnucash.appdata.xml.in.h:9
 msgid "QIF/OFX/HBCI Import, Transaction Matching"
-msgstr ""
+msgstr "Datenaustausch via FinTS(HBCI)/SWIFT-MT9xx/QIF/OFX und Abgleich"
 
 #: ../src/gnome/gnucash.appdata.xml.in.h:10
 msgid "Perform financial calculations, such as a loan repayment"
-msgstr ""
+msgstr "Finanzkalkulationen ausführen wie Kredit-Rückzahlung"
 
 #: ../src/gnome/gnucash.desktop.in.in.h:1
 msgid "GnuCash"
@@ -25906,6 +26013,7 @@ msgstr "Finanzmanagement"
 msgid "Manage your finances, accounts, and investments"
 msgstr "Verwaltung der Finanzen von Privatanwendern und Kleinbetrieben."
 
+# Fixme: Source qofbookslots: All accelerators missing
 #: ../src/libqof/qof/qofbookslots.h:66
 msgid "Use Trading Accounts"
 msgstr "Devisenhandel-Konten benutzen"
@@ -26263,9 +26371,8 @@ msgstr ""
 #~ msgid "(USD)"
 #~ msgstr "(USD)"
 
-#, fuzzy
 #~ msgid "Retrieve the current online quote"
-#~ msgstr "Aktuellen Buchungsteil löschen"
+#~ msgstr "Aktuellen Kurs online abrufen"
 
 #~ msgid "Auto pay on post_ing"
 #~ msgstr "Automatisch durchbuchen"

commit 64cfab0508bd804b195032b4fa98ecbf48c8a92f
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 20 11:33:54 2017 +0200

    Fix wiki link

diff --git a/src/engine/ScrubBusiness.c b/src/engine/ScrubBusiness.c
index aa48ea3..2a1be67 100644
--- a/src/engine/ScrubBusiness.c
+++ b/src/engine/ScrubBusiness.c
@@ -519,7 +519,7 @@ gncScrubBusinessLot (GNCLot *lot)
 gboolean
 gncScrubBusinessSplit (Split *split)
 {
-    const gchar *memo = _("Please delete this transaction. Explanation at http://wiki.gnucash.org/wiki/Business_Features_Issues#Double_Posting");
+    const gchar *memo = _("Please delete this transaction. Explanation at https://wiki.gnucash.org/wiki/Business_Features_Issues#Double_posting");
     Transaction *txn;
     gboolean deleted_split = FALSE;
 

commit e26c55e6cb1b7c26c7cea2ef57a2d99fdbc2b105
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Fri Oct 13 10:35:09 2017 +0200

    update de.po to commit f283437

diff --git a/po/de.po b/po/de.po
index a5d6b6f..a1c0f5f 100644
--- a/po/de.po
+++ b/po/de.po
@@ -15,7 +15,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: GnuCash 2.6.15\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-09-11 02:57+0200\n"
+"POT-Creation-Date: 2017-10-13 10:24+0200\n"
 "PO-Revision-Date: 2017-09-11 04:33+0200\n"
 "Last-Translator: Mechtilde <ooo at mechtilde.de>\n"
 "Language-Team: GnuCash-de <gnucash-de at gnucash.org>\n"
@@ -27,12 +27,12 @@ msgstr ""
 "X-Generator: Lokalize 1.5\n"
 
 #. Business options
-#: ../src/app-utils/app-utils.scm:304
+#: ../src/app-utils/app-utils.scm:305
 #: ../src/business/business-gnome/gncmod-business-gnome.c:117
 msgid "Business"
 msgstr "Geschäft"
 
-#: ../src/app-utils/app-utils.scm:305
+#: ../src/app-utils/app-utils.scm:306
 #: ../src/business/business-gnome/dialog-customer.c:923
 #: ../src/business/business-gnome/dialog-vendor.c:726
 #: ../src/gnome-utils/gnc-tree-view-owner.c:380
@@ -41,31 +41,31 @@ msgstr "Geschäft"
 msgid "Company Name"
 msgstr "Firmenname"
 
-#: ../src/app-utils/app-utils.scm:306
+#: ../src/app-utils/app-utils.scm:307
 msgid "Company Address"
 msgstr "Firmenadresse"
 
-#: ../src/app-utils/app-utils.scm:307
+#: ../src/app-utils/app-utils.scm:308
 msgid "Company ID"
 msgstr "Firmennummer"
 
-#: ../src/app-utils/app-utils.scm:308
+#: ../src/app-utils/app-utils.scm:309
 msgid "Company Phone Number"
 msgstr "Firmentelefonnummer"
 
-#: ../src/app-utils/app-utils.scm:309
+#: ../src/app-utils/app-utils.scm:310
 msgid "Company Fax Number"
 msgstr "Firmenfaxnummer"
 
-#: ../src/app-utils/app-utils.scm:310
+#: ../src/app-utils/app-utils.scm:311
 msgid "Company Website URL"
 msgstr "Firmenwebseite URL"
 
-#: ../src/app-utils/app-utils.scm:311
+#: ../src/app-utils/app-utils.scm:312
 msgid "Company Email Address"
 msgstr "Firmen-E-Mail-Adresse"
 
-#: ../src/app-utils/app-utils.scm:312
+#: ../src/app-utils/app-utils.scm:313
 msgid "Company Contact Person"
 msgstr "Firmen Ansprechpartner"
 
@@ -842,7 +842,7 @@ msgstr "Soll"
 msgid "Credit"
 msgstr "Haben"
 
-#: ../src/app-utils/option-util.c:1685
+#: ../src/app-utils/option-util.c:1656
 #, c-format
 msgid ""
 "There is a problem with option %s:%s.\n"
@@ -2015,7 +2015,7 @@ msgstr "Gutschrift?"
 #: ../src/gnome/dialog-lot-viewer.c:931 ../src/gnome/reconcile-view.c:373
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:2992
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3004
-#: ../src/import-export/aqb/dialog-ab.glade.h:35
+#: ../src/import-export/aqb/dialog-ab.glade.h:39
 #: ../src/import-export/import-main-matcher.c:467
 #: ../src/import-export/import-match-picker.c:394
 #: ../src/import-export/import-match-picker.c:434
@@ -11059,31 +11059,31 @@ msgid "Select the default selection."
 msgstr "Die voreingestellte Auswahl auswählen."
 
 #. The reset button on each option page
-#: ../src/gnome-utils/dialog-options.c:1131
+#: ../src/gnome-utils/dialog-options.c:1136
 msgid "Reset defaults"
 msgstr "Voreinstellungen"
 
-#: ../src/gnome-utils/dialog-options.c:1133
+#: ../src/gnome-utils/dialog-options.c:1138
 msgid "Reset all values to their defaults."
 msgstr "Alle Werte auf ihre Voreinstellung zurücksetzen."
 
-#: ../src/gnome-utils/dialog-options.c:1459
+#: ../src/gnome-utils/dialog-options.c:1464
 msgid "Page"
 msgstr "Seite"
 
-#: ../src/gnome-utils/dialog-options.c:2139
+#: ../src/gnome-utils/dialog-options.c:2144
 msgid "Clear"
 msgstr "Zurücksetzen"
 
-#: ../src/gnome-utils/dialog-options.c:2140
+#: ../src/gnome-utils/dialog-options.c:2145
 msgid "Clear any selected image file."
 msgstr "Auswahl der Bilddatei wieder löschen."
 
-#: ../src/gnome-utils/dialog-options.c:2142
+#: ../src/gnome-utils/dialog-options.c:2147
 msgid "Select image"
 msgstr "Bild auswählen"
 
-#: ../src/gnome-utils/dialog-options.c:2144
+#: ../src/gnome-utils/dialog-options.c:2149
 msgid "Select an image file."
 msgstr "Bilddatei auswählen."
 
@@ -15762,127 +15762,163 @@ msgid "Confirm Password:"
 msgstr "Passwort bestätigen:"
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:21
-msgid "Remember _PIN"
-msgstr "_PIN merken"
+#, fuzzy
+msgid "Remember the _PIN in memory"
+msgstr "HBCI PIN im Speicher merken"
 
 #: ../src/import-export/aqb/dialog-ab.glade.h:22
+#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:6
+msgid ""
+"If active, the PIN for HBCI/AqBanking actions will be remembered in memory "
+"during a session. Otherwise it will have to be entered again each time "
+"during a session when it is needed."
+msgstr ""
+"Wenn aktiviert, wird die PIN (Persönliche Identifikationsnummer) für HBCI/"
+"AqBanking während einer Programmbenutzung im Speicher zwischengespeichert. "
+"Wenn nicht aktiviert, muss die PIN bei jeder einzelnen Aktion von HBCI/"
+"AqBanking eingegeben werden und wird nicht im Speicher gehalten."
+
+#: ../src/import-export/aqb/dialog-ab.glade.h:23
 msgid "<b>Online Banking</b>"
 msgstr "<b>Onlinebanking</b>"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:23
+#: ../src/import-export/aqb/dialog-ab.glade.h:24
 msgid "_Close log window when finished"
 msgstr "Fenster nach Verbindungsende _schließen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:24
+#: ../src/import-export/aqb/dialog-ab.glade.h:25
+#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:4
+msgid ""
+"If active, the window will be closed automatically when you finish the HBCI/"
+"AqBanking import process. Otherwise it will stay open."
+msgstr ""
+"Wenn aktiviert, wird das Fenster automatisch geschlossen, wenn der HBCI/"
+"AqBanking-Import beendet ist. Andernfalls bleibt das Fenster geöffnet."
+
+#: ../src/import-export/aqb/dialog-ab.glade.h:26
 #, fuzzy
 msgid "Use Non-SWIFT _transaction text"
 msgstr "Verwende das dem Buchungsdatum nächste Datum."
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:25
+#: ../src/import-export/aqb/dialog-ab.glade.h:27
+#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:8
+msgid ""
+"Some banks place part of transaction description as \"transaction text\" in "
+"the MT940 file. Normally GNUcash ignores this text. However by activating "
+"this option, the transaction text is used for the transaction description "
+"too."
+msgstr ""
+
+#: ../src/import-export/aqb/dialog-ab.glade.h:28
 msgid "_Verbose debug messages"
 msgstr "Ausführliche _Fehlermeldungen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:26
+#: ../src/import-export/aqb/dialog-ab.glade.h:29
+#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:10
+msgid "Enables verbose debug messages for HBCI/AqBanking Online Banking."
+msgstr "Ausführliche Fehlermeldungen für HBCI Online Banking aktivieren."
+
+#: ../src/import-export/aqb/dialog-ab.glade.h:30
 msgid "Name for new template"
 msgstr "Namen für neue Überweisungsvorlage"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:27
+#: ../src/import-export/aqb/dialog-ab.glade.h:31
 msgid "Enter name for new template:"
 msgstr "Bitte geben Sie einen Namen für die neue Überweisungsvorlage ein:"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:28
+#: ../src/import-export/aqb/dialog-ab.glade.h:32
 msgid "Online Transaction"
 msgstr "Online-Auftrag Einzelüberweisung"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:29
+#: ../src/import-export/aqb/dialog-ab.glade.h:33
 msgid "Enter an Online Transaction"
 msgstr "Online-Ãœberweisung eingeben"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:30
+#: ../src/import-export/aqb/dialog-ab.glade.h:34
 msgid "Recipient Account Number"
 msgstr "Konto-Nr. des Empfängers"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:31
+#: ../src/import-export/aqb/dialog-ab.glade.h:35
 msgid "Recipient Bank Code"
 msgstr "Bankleitzahl"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:32
+#: ../src/import-export/aqb/dialog-ab.glade.h:36
 msgid "Recipient Name"
 msgstr "Empfänger: Name, Vorname / Firma"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:33
+#: ../src/import-export/aqb/dialog-ab.glade.h:37
 msgid "at Bank"
 msgstr "der Bank"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:34
+#: ../src/import-export/aqb/dialog-ab.glade.h:38
 msgid "(filled in automatically)"
 msgstr "(wird automatisch ausgefüllt)"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:36
+#: ../src/import-export/aqb/dialog-ab.glade.h:40
 msgid "Payment Purpose (only for recipient)"
 msgstr "Verwendungszweck - z.B. Kunden-Referenznummer - (nur für Empfänger)"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:37
+#: ../src/import-export/aqb/dialog-ab.glade.h:41
 msgid "Payment Purpose continued"
 msgstr "noch Verwendungszweck (ggf. noch Anschrift des Auftraggebers)"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:38
+#: ../src/import-export/aqb/dialog-ab.glade.h:42
 msgid "Originator Name"
 msgstr "Auftraggeber: Name, Vorname"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:39
+#: ../src/import-export/aqb/dialog-ab.glade.h:43
 msgid "something"
 msgstr "irgendwas"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:40
+#: ../src/import-export/aqb/dialog-ab.glade.h:44
 msgid "Originator Account Number"
 msgstr "Konto-Nr. des Auftraggebers"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:41
+#: ../src/import-export/aqb/dialog-ab.glade.h:45
 msgid "Bank Code"
 msgstr "Bankleitzahl"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:42
+#: ../src/import-export/aqb/dialog-ab.glade.h:46
 msgid "Add the current online transaction as a new transaction template"
 msgstr "Aktuelle Online-Buchung als neue Überweisungsvorlage hinzufügen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:43
+#: ../src/import-export/aqb/dialog-ab.glade.h:47
 msgid "Add current"
 msgstr "Aktuelle hinzufügen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:44
+#: ../src/import-export/aqb/dialog-ab.glade.h:48
 msgid "Move the selected transaction template one row up"
 msgstr "Gewählte Überweisungsvorlage eine Zeile nach oben umsortieren"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:45
+#: ../src/import-export/aqb/dialog-ab.glade.h:49
 msgid "Move the selected transaction template one row down"
 msgstr "Gewählte Überweisungsvorlage eine Zeile nach unten umsortieren"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:46
+#: ../src/import-export/aqb/dialog-ab.glade.h:50
 msgid "Sort the list of transaction templates alphabetically"
 msgstr "Die Liste der Ãœberweisungsvorlagen alphabetisch sortieren"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:47
+#: ../src/import-export/aqb/dialog-ab.glade.h:51
 msgid "Sort"
 msgstr "Sortieren"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:48
+#: ../src/import-export/aqb/dialog-ab.glade.h:52
 msgid "Delete the currently selected transaction template"
 msgstr "Ausgewählte Überweisungsvorlage löschen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:49
+#: ../src/import-export/aqb/dialog-ab.glade.h:53
 msgid "Templates"
 msgstr "Vorlagen"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:50
+#: ../src/import-export/aqb/dialog-ab.glade.h:54
 msgid "Execute later (unimpl.)"
 msgstr "Später ausführen (unfertig)"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:51
+#: ../src/import-export/aqb/dialog-ab.glade.h:55
 msgid "Execute this online transaction now"
 msgstr "Diesen Auftrag jetzt online abschicken"
 
-#: ../src/import-export/aqb/dialog-ab.glade.h:52
+#: ../src/import-export/aqb/dialog-ab.glade.h:56
 msgid "Execute Now"
 msgstr "Jetzt ausführen"
 
@@ -16480,29 +16516,10 @@ msgstr "Online-Banking Verlaufsfenster anzeigen"
 msgid "Close window when finished"
 msgstr "Fenster nach Verbindungsende schließen"
 
-#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:4
-msgid ""
-"If active, the window will be closed automatically when you finish the HBCI/"
-"AqBanking import process. Otherwise it will stay open."
-msgstr ""
-"Wenn aktiviert, wird das Fenster automatisch geschlossen, wenn der HBCI/"
-"AqBanking-Import beendet ist. Andernfalls bleibt das Fenster geöffnet."
-
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:5
 msgid "Remember the PIN in memory"
 msgstr "HBCI PIN im Speicher merken"
 
-#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:6
-msgid ""
-"If active, the PIN for HBCI/AqBanking actions will be remembered in memory "
-"during a session. Otherwise it will have to be entered again each time "
-"during a session when it is needed."
-msgstr ""
-"Wenn aktiviert, wird die PIN (Persönliche Identifikationsnummer) für HBCI/"
-"AqBanking während einer Programmbenutzung im Speicher zwischengespeichert. "
-"Wenn nicht aktiviert, muss die PIN bei jeder einzelnen Aktion von HBCI/"
-"AqBanking eingegeben werden und wird nicht im Speicher gehalten."
-
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:7
 #, fuzzy
 msgid "Put the transaction text in front of the purpose of a transaction."
@@ -16510,22 +16527,10 @@ msgstr ""
 "Alle Buchungssätze außer dem aktuellen einzeilig anzeigen. Den aktuellen "
 "Buchungssatz vollständig anzeigen."
 
-#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:8
-msgid ""
-"Some banks place part of transaction description as \"transaction text\" in "
-"the MT940 file. Normally GNUcash ignores this text. However by activating "
-"this option, the transaction text is used for the transaction description "
-"too."
-msgstr ""
-
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:9
 msgid "Verbose HBCI debug messages"
 msgstr "Ausführliche HBCI-Fehlermeldungen"
 
-#: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:10
-msgid "Enables verbose debug messages for HBCI/AqBanking Online Banking."
-msgstr "Ausführliche Fehlermeldungen für HBCI Online Banking aktivieren."
-
 #: ../src/import-export/aqb/gschemas/org.gnucash.dialogs.import.hbci.gschema.xml.in.in.h:11
 msgid "DTAUS import data format"
 msgstr "DTAUS-Import Dateiformat"
@@ -26202,6 +26207,9 @@ msgstr ""
 "wählen Sie im Menü 'Fenster -> Neues Fenster mit Seite', um diesen Reiter in "
 "einem neuen Fenster anzuzeigen "
 
+#~ msgid "Remember _PIN"
+#~ msgstr "_PIN merken"
+
 #~ msgid "CURRENCY"
 #~ msgstr "WÄHRUNG"
 

commit f2834377bc32a60f7de377900ad586f505da26a4
Merge: 3cdac65 0b3da70
Author: fell <frank.h.ellenberger at gmail.com>
Date:   Wed Oct 11 23:07:55 2017 +0200

    Merge branch 'maint' of https://github.com/DiMan/Gnucash into maint


commit 0b3da701238dab938ec70de6f830672807d13d03
Author: Di Mang <dimang.freenet at gmail.com>
Date:   Sat Oct 7 02:28:44 2017 +0200

    Adjustment of some Russian translations

diff --git a/po/ru.po b/po/ru.po
index 4a6dbbc..8451a09 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -9,14 +9,15 @@
 # Sergey Belyashov <Sergey.Belyashov at gmail.com>, 2009, 2011.
 # Dmitry Pavlov  <zeldigas at gmail.com>, 2014.
 # ashed <craysy at gmail.com>, 2017
+# Dmitriy Mangul <dimang.freetime at gmail.com>, 2017
 msgid ""
 msgstr ""
 "Project-Id-Version: GnuCash 2.6.18\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-10-02 06:36+0200\n"
 "PO-Revision-Date: 2017-10-01 04:09+0500\n"
-"Last-Translator: ashed <craysy at gmail.com>\n"
-"Language-Team: russian <ru at li.org>\n"
+"Last-Translator: Dmitriy Mangul <dimang.freetime at gmail.com>\n"
+"Language-Team: russian <gnucash-ru at googlegroups.com>\n"
 "Language: ru\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -47,7 +48,7 @@ msgstr "Адрес фирмы"
 
 #: ../src/app-utils/app-utils.scm:308
 msgid "Company ID"
-msgstr "ID фирмы"
+msgstr "Идентификатор фирмы"
 
 #: ../src/app-utils/app-utils.scm:309
 msgid "Company Phone Number"
@@ -71,7 +72,7 @@ msgstr "Контактное лицо фирмы"
 
 #: ../src/app-utils/business-prefs.scm:24
 msgid "Counters"
-msgstr "Счётчики"
+msgstr "Номера"
 
 #: ../src/app-utils/business-prefs.scm:31
 msgid "Customer number format"
@@ -296,7 +297,7 @@ msgstr "URL адрес вашего сайта."
 
 #: ../src/app-utils/business-prefs.scm:107
 msgid "The ID for your company (eg 'Tax-ID: 00-000000)."
-msgstr "ID вашей фирмы (например 'Tax-ID:00-000000)."
+msgstr "Идентификатор вашей фирмы (например 'Tax-ID:00-000000)."
 
 #: ../src/app-utils/business-prefs.scm:112
 msgid "Default Customer TaxTable"
@@ -316,11 +317,11 @@ msgstr "Таблица налогов применяемая по умолчан
 
 #: ../src/app-utils/business-prefs.scm:124
 msgid "Fancy Date Format"
-msgstr "Современный формат даты"
+msgstr "Расширенный формат даты"
 
 #: ../src/app-utils/business-prefs.scm:125
 msgid "The default date format used for fancy printed dates."
-msgstr "Формат даты используемый для печати современных дат"
+msgstr "Настройки для печати даты в расширенном формате."
 
 #: ../src/app-utils/business-prefs.scm:133
 msgid ""
@@ -339,9 +340,10 @@ msgid ""
 msgstr ""
 "Укажите число дней после истечения которых проводки будут доступны только "
 "для просмотра и не смогут быть отредактированы. Эта граница помечена красной "
-"линией в окне журнала проводок. Если значение установлено в 0, все "
-"транзакции можно изменять."
+"линией в окне журнала проводок. Если установлено значение 0, то можно изменять "
+"все транзакции."
 
+# TODO: check translation
 # "Отметьте для размещения поля с типом проводки,  для ввода номеров проводок. "
 # "Номер проводки отображаемый как \"№\" на второй строке реестра"
 #: ../src/app-utils/business-prefs.scm:150
@@ -358,7 +360,7 @@ msgstr ""
 
 #: ../src/app-utils/business-prefs.scm:158
 msgid "Budget to be used when none has been otherwise specified."
-msgstr "Используемый бюджет, если явно не указано."
+msgstr "Бюджет, который будет использоваться по умолчанию, если не указано что-то другое."
 
 #: ../src/app-utils/date-utilities.scm:122
 #: ../src/report/standard-reports/account-piecharts.scm:470
@@ -841,7 +843,6 @@ msgstr ""
 #: ../src/app-utils/prefs.scm:63
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3184
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3191
-#, fuzzy
 msgid "Funds In"
 msgstr "Средства в"
 
@@ -990,7 +991,6 @@ msgstr "Счёт-фактура"
 #: ../src/app-utils/prefs.scm:80
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3103
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3110
-#, fuzzy
 msgid "Funds Out"
 msgstr "Средства из"
 
@@ -1199,7 +1199,7 @@ msgid ""
 "This copy was built from %s rev %s on %s."
 msgstr ""
 "%s\n"
-"Эта копия собрана из %s, ревизия %s. Дата сборки %s."
+"Эта копия собрана из %s, ревизия %s. \nДата сборки %s."
 
 #: ../src/bin/gnucash-bin.c:458
 #, c-format
@@ -1334,7 +1334,7 @@ msgstr "Нет такого счета: %s"
 
 #: ../src/business/business-gnome/dialog-billterms.c:265
 msgid "Discount days cannot be more than due days."
-msgstr "Дни скидок не могут быть больше, чем в выходные дни."
+msgstr "Дисконтных дней не может быть больше, чем дней для оплаты."
 
 #: ../src/business/business-gnome/dialog-billterms.c:324
 msgid "You must provide a name for this Billing Term."
@@ -1397,7 +1397,7 @@ msgid ""
 "below."
 msgstr ""
 "Эта проводка должна быть назначена поставщику. Пожалуйста, выберите "
-"поставщика ниже."
+"Поставщика ниже."
 
 #: ../src/business/business-gnome/dialog-customer.c:329
 msgid ""
@@ -2307,7 +2307,7 @@ msgstr "Открыть диалог создания новых операций
 #: ../src/business/business-gnome/gnc-plugin-business.c:185
 #: ../src/business/business-gnome/gnc-plugin-business.c:228
 msgid "Find Jo_b..."
-msgstr "Найти _задачу..."
+msgstr "Найти о_перацию..."
 
 #: ../src/business/business-gnome/gnc-plugin-business.c:186
 #: ../src/business/business-gnome/gnc-plugin-business.c:229
@@ -2979,7 +2979,7 @@ msgid ""
 "well. Otherwise they are not shown."
 msgstr ""
 "При включении, отображаются дополнительные кнопки для стандартных бизнес "
-"операций. В противном случае они не показываются"
+"операций. В противном случае они не показываются."
 
 #: ../src/business/business-gnome/gschemas/org.gnucash.dialogs.business.gschema.xml.in.in.h:11
 #: ../src/business/business-gnome/gtkbuilder/business-prefs.glade.h:23
@@ -3203,7 +3203,7 @@ msgstr "Подтвердить этот срок оплаты"
 
 #: ../src/business/business-gnome/gtkbuilder/dialog-billterms.glade.h:3
 msgid "<b>Term Definition</b>"
-msgstr "<b>Определение срока</b>"
+msgstr "<b>Параметры срока</b>"
 
 #: ../src/business/business-gnome/gtkbuilder/dialog-billterms.glade.h:4
 msgid "De_scription:"
@@ -9172,7 +9172,7 @@ msgstr "Конец"
 # Частичное гашение долга
 #: ../src/gnome/gtkbuilder/dialog-fincalc.glade.h:21
 msgid "<b>Compounding:</b>"
-msgstr "<b>Компаундинг:</b>"
+msgstr "<b>Начисление процентов:</b>"
 
 #: ../src/gnome/gtkbuilder/dialog-fincalc.glade.h:22
 msgid "<b>Period:</b>"
@@ -12026,7 +12026,7 @@ msgstr "Настройки книги"
 #: ../src/gnome-utils/gnc-main-window.c:4370
 msgid "The GnuCash personal finance manager. The GNU way to manage your money!"
 msgstr ""
-"Персональный финансовый менеджер GnuCash. GNU-способ распоряжения вашими "
+"Персональный финансовый менеджер GnuCash. \nGNU-способ распоряжения вашими "
 "деньгами!"
 
 #: ../src/gnome-utils/gnc-main-window.c:4372
@@ -12046,7 +12046,8 @@ msgstr ""
 "Владимир Турбаевский\n"
 "Сергей Беляшов\n"
 "Дмитрий Павлов <zeldigas at gmail.com>\n"
-"ashed <craysy at gmail.com>"
+"ashed <craysy at gmail.com>\n"
+"Дмитрий Мангул <dimang.freetime at gmail.com>"
 
 #: ../src/gnome-utils/gnc-period-select.c:73
 msgid "Start of this quarter"
@@ -12509,7 +12510,7 @@ msgstr "_Пересчитать"
 #: ../src/report/standard-reports/transaction.scm:954
 #: ../src/report/standard-reports/trial-balance.scm:664
 msgid "Account Name"
-msgstr "Название счета"
+msgstr "Название счёта"
 
 #: ../src/gnome-utils/gnc-tree-view-account.c:730
 #: ../src/gnome-utils/gnc-tree-view-split-reg.c:3016
@@ -12527,7 +12528,7 @@ msgstr "Товар"
 #: ../src/report/standard-reports/transaction.scm:790
 #: ../src/report/standard-reports/transaction.scm:956
 msgid "Account Code"
-msgstr "Код счета"
+msgstr "Код счёта"
 
 #: ../src/gnome-utils/gnc-tree-view-account.c:748
 msgid "Last Num"
@@ -13979,7 +13980,7 @@ msgstr "<b>Дополнение даты</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:60
 msgid "When a date is entered without year, it should be taken:"
-msgstr "Если дата введена без года, то она должна быть взята:"
+msgstr "Если дата введена без года, то она должна быть дополнена:"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:62
 msgid ""
@@ -14285,7 +14286,7 @@ msgstr "<b>Стиль по умолчанию</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:146
 msgid "<b>Other Defaults</b>"
-msgstr "<b>Другие Умолчания</b>"
+msgstr "<b>Другие Настройки</b>"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:147
 msgid "_Basic ledger"
@@ -14361,7 +14362,7 @@ msgstr "Отображать даты создания и согласовани
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:171
 msgid "Register Defaults"
-msgstr "Умолчания журнала"
+msgstr "Настройки журнала"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:174
 msgid "<b>Default Report Currency</b>"
@@ -14523,7 +14524,7 @@ msgstr "_Название: "
 
 #: ../src/gnome-utils/gtkbuilder/dialog-tax-table.glade.h:7
 msgid "Tax Tables"
-msgstr "<b>Таблицы налогов</b>"
+msgstr "Таблицы налогов"
 
 #: ../src/gnome-utils/gtkbuilder/dialog-tax-table.glade.h:8
 msgid "<b>Tax Tables</b>"
@@ -14638,19 +14639,19 @@ msgstr "%Y-%m-%d"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:5
 msgid "Include Century"
-msgstr "Включить век"
+msgstr "Указывать век"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:7
 msgid "Abbreviation"
-msgstr "Аббревиатура"
+msgstr "Сокращение"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:9
 msgid "Months:"
-msgstr "Месяцы:"
+msgstr "Месяца:"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:10
 msgid "Years:"
-msgstr "Годы:"
+msgstr "Года:"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:11
 #: ../src/import-export/dialog-import.glade.h:5
@@ -14683,7 +14684,7 @@ msgstr "UTC - Скоординированное универсальное вр
 
 #: ../src/gnome-utils/gtkbuilder/gnc-date-format.glade.h:21
 msgid "No Fancy Date Format"
-msgstr "Нет Современного формата даты"
+msgstr "Нет расширенного формата даты"
 
 #: ../src/gnome-utils/gtkbuilder/gnc-frequency.glade.h:3
 msgid "Not scheduled"
@@ -25691,7 +25692,7 @@ msgstr "Использовать торговые счета"
 
 #: ../src/libqof/qof/qofbookslots.h:67
 msgid "Day Threshold for Read-Only Transactions (red line)"
-msgstr "Граница начала неизм-х проводок в днях (красн. линия)"
+msgstr "Дневной лимит для неизменяемых проводок (красная линия)"
 
 #: ../src/libqof/qof/qofbookslots.h:68
 msgid "Use Split Action Field for Number"
@@ -25720,7 +25721,7 @@ msgid ""
 "The GnuCash online manual has lots of helpful information. You can access "
 "the manual under the Help menu."
 msgstr ""
-"Онлайновое руководство по GnuCash содержит много полезной информации. "
+"Практическое руководство по GnuCash содержит много полезной информации. "
 "Получить доступ к руководству можно через меню \"Справка\"."
 
 #: ../doc/tip_of_the_day.list.in:4
@@ -25731,7 +25732,7 @@ msgid ""
 "follow the instructions provided."
 msgstr ""
 "Вы можете очень просто импортировать имеющиеся у вас финансовые данные из "
-"таких программ, как Qucken, MS Money и других, позволяющих экспортировать в "
+"таких программ, как Quicken, MS Money и других, позволяющих экспортировать данные в "
 "формат файлов QIF или OFX. В меню \"Файл\" выберите подменю \"Импорт\" и "
 "выберите нужный файл QIF или OFX. Далее следуйте предложенным инструкциям."
 
@@ -25745,7 +25746,7 @@ msgstr ""
 "Если вы уже работали с другими финансовыми программами, такими как Quicken, "
 "заметьте, что GnuCash использует счета вместо категорий для отслеживания "
 "приходов и расходов. За дополнительной информацией о счетах Приход и Расход, "
-"пожалуйста, обращайтесь к онлайновому руководству GnuCash."
+"пожалуйста, обращайтесь к практическому руководству GnuCash."
 
 #: ../doc/tip_of_the_day.list.in:14
 msgid ""
@@ -25757,7 +25758,7 @@ msgstr ""
 "Создавайте новые счета нажатием кнопки \"Новый\" на панели инструментов "
 "главного окна. Это вызовет появление диалога, где вы сможете указать "
 "различные параметры счёта. За дополнительной информацией по выбору типа "
-"счёта или настройке плана счетов, обращайтесь к онлайновому руководству "
+"счёта или настройке плана счетов, обращайтесь к практическому руководству "
 "GnuCash."
 
 #: ../doc/tip_of_the_day.list.in:20
@@ -25778,9 +25779,9 @@ msgid ""
 "View menu, you can choose the register style Auto-Split Ledger or "
 "Transaction Journal."
 msgstr ""
-"Чтобы ввести проводку, состоящую из нескольких частей, такую как Платёж по "
+"Чтобы ввести проводку, состоящую из нескольких частей, такую как платёж по "
 "чеку с различными удержаниями, нажмите кнопку \"Части\" на панели "
-"инструментов. Также вы можете выбрать стиль журнала в меню \"Вид\",например "
+"инструментов. Также вы можете выбрать стиль журнала в меню \"Вид\", например "
 "\"Авторазворачиваемый\" или \"Журнал проводок\"."
 
 #: ../doc/tip_of_the_day.list.in:30
@@ -25803,8 +25804,8 @@ msgid ""
 "was last entered."
 msgstr ""
 "Быстрое заполнение упрощает ввод повторяющихся проводок. Когда вы набираете "
-"первые буквы описания какой-либо частой проводки, GnuCash будет "
-"автоматически дополнять оставшуюся часть описания так, как она была введена "
+"первые буквы описания какой-либо частой проводки, GnuCash "
+"автоматически дополняет оставшуюся часть описания так, как она была введена "
 "до этого."
 
 #: ../doc/tip_of_the_day.list.in:40
@@ -25817,8 +25818,8 @@ msgid ""
 msgstr ""
 "Наберите первые несколько букв существующего имени счёта в колонке \"Передать"
 "\" журнала проводок, и GnuCash завершит название из вашего списка счетов. "
-"Для подсчетов, наберите первые буквы родительского счёта, затем символ "
-"двоеточия и первые буквы субсчетов (например, А:Н для получения Активы:"
+"Для субсчетов, наберите первые буквы родительского счёта, затем символ "
+"двоеточия и первые буквы субсчёта (например, А:Н для получения Активы:"
 "Наличные)."
 
 #: ../doc/tip_of_the_day.list.in:46
@@ -25828,8 +25829,8 @@ msgid ""
 "Edit -> Open Subaccounts from the menu."
 msgstr ""
 "Желаете увидеть все проводки субсчетов в одном журнале? Во вкладке Счета "
-"главного окна выделите родительский счёт и выберите из меню Правка -> "
-"Открыть субсчета."
+"главного окна выделите родительский счёт и выберите из меню \"Правка\" -> "
+"\"Открыть субсчета\"."
 
 #: ../doc/tip_of_the_day.list.in:50
 msgid ""
@@ -25886,7 +25887,7 @@ msgid ""
 "report as a report option, and use the Edit -> Style Sheets menu to "
 "customize style sheets."
 msgstr ""
-"Стили оформления действуют на то, как будут показываться отчеты. Выберите "
+"Стили оформления влияют на то, как будут показываться отчеты. Выберите "
 "стиль оформления для вашего отчета и используйте меню \"Правка\" - \"Стили "
 "оформления\" для его настройки."
 
@@ -25964,7 +25965,7 @@ msgid ""
 "from the main accounts hierarchy page. To limit your search to a single "
 "account, start the search from that account's register."
 msgstr ""
-"Для поиска по всем транзакциям, откройте диалог поиска (Правка -> Найти...) "
+"Для поиска по всем транзакциям, откройте диалог поиска (\"Правка\" -> \"Найти...\") "
 "со страницы иерархии счетов. Чтобы искать в пределах одного счета, откройте "
 "диалог поиска со страницы журнала этого счета."
 
@@ -25974,8 +25975,8 @@ msgid ""
 "select Window -> New Window with Page from the menu to duplicate that tab in "
 "a new window."
 msgstr ""
-"Чтобы визуально сравнить на экране содержимое двух вкладок в одной из "
-"вкладок, выберите Окно -> Новое окно со страницей из меню, чтобы дублировать "
+"Чтобы визуально сравнить на экране содержимое двух вкладок, выберите в одной из "
+"вкладок \"Окно\" -> \"Новое окно со страницей\" из меню, чтобы продублировать "
 "эту вкладку в новом окне."
 
 #~ msgid "Dummy message"



Summary of changes:
 bindings/python/CMakeLists.txt                     |  18 +-
 common/cmake_modules/GncAddSchemeTargets.cmake     |  13 +-
 common/cmake_modules/MakeDistFiles.cmake           |  14 -
 common/test-core/CMakeLists.txt                    |   6 -
 configure.ac                                       |  32 -
 data/accounts/de_DE/acctchrt_skr03.gnucash-xea     |   4 +-
 gnucash/CMakeLists.txt                             |   9 +-
 gnucash/gnome-search/dialog-search.c               |   1 +
 gnucash/gnome-utils/CMakeLists.txt                 |   9 -
 gnucash/gnome-utils/gnc-dense-cal.c                |  95 +--
 gnucash/gnome-utils/gnc-dense-cal.h                |   3 +
 gnucash/gnome-utils/gnc-tree-control-split-reg.c   |   1 +
 .../gtkbuilder/dialog-preferences.glade            |  26 +-
 gnucash/gnome-utils/test/CMakeLists.txt            |  19 +-
 gnucash/gnome-utils/test/Makefile.am               |  13 +-
 ...-module.in => test-load-gnome-utils-module.scm} |   4 -
 gnucash/gnome/dialog-payment.c                     | 797 ++++++++++++++++-----
 gnucash/gnome/dialog-payment.h                     |   2 +-
 gnucash/gnome/gnc-plugin-business.c                |  37 +-
 gnucash/gnome/gnc-plugin-business.h                |   4 +
 gnucash/gnome/gnc-plugin-page-register.c           |  23 +-
 gnucash/gnome/gnc-plugin-page-register.h           |  10 +
 gnucash/gnome/gnc-split-reg.c                      |   4 +-
 gnucash/gnome/gtkbuilder/dialog-payment.glade      |  47 +-
 .../gtkbuilder/gnc-plugin-page-register.glade      |  22 +-
 gnucash/gnome/ui/gnc-plugin-business-ui.xml        |   6 +-
 gnucash/gnucash-310.css                            |  13 +-
 gnucash/gnucash-320.css                            |  11 +-
 .../csv-exp/csv-transactions-export.c              |   9 +-
 gnucash/import-export/dialog-import.glade          |  24 +-
 gnucash/import-export/qif-imp/CMakeLists.txt       |   9 -
 gnucash/register/ledger-core/gncEntryLedgerModel.c |  49 +-
 .../register/ledger-core/split-register-layout.c   |  21 +-
 .../register/ledger-core/split-register-model.c    | 217 +++---
 gnucash/register/register-core/table-allgui.c      |  57 +-
 gnucash/register/register-core/table-allgui.h      |  42 +-
 gnucash/register/register-core/table-model.c       |  72 +-
 gnucash/register/register-core/table-model.h       |  29 +-
 gnucash/register/register-core/test/Makefile.am    |   2 -
 gnucash/register/register-gnome/gnucash-header.c   |  58 +-
 .../register/register-gnome/gnucash-item-edit.c    | 308 +++++++-
 .../register/register-gnome/gnucash-item-edit.h    |  39 +-
 .../register-gnome/gnucash-sheet-private.c         |  49 +-
 gnucash/register/register-gnome/gnucash-sheet.c    | 113 +--
 gnucash/register/register-gnome/gnucash-sheet.h    |  10 +-
 gnucash/register/register-gnome/gnucash-style.c    |  20 +-
 gnucash/register/register-gnome/test/Makefile.am   |   2 -
 gnucash/report/business-reports/CMakeLists.txt     |  11 +-
 gnucash/report/locale-specific/us/CMakeLists.txt   |  11 -
 .../report/locale-specific/us/test/CMakeLists.txt  |  17 +-
 ...=> test-load-report-locale-specific-module.scm} |   5 -
 gnucash/report/report-gnome/CMakeLists.txt         |   6 -
 gnucash/report/report-gnome/test/CMakeLists.txt    |  18 +-
 gnucash/report/report-gnome/test/Makefile.am       |  13 +-
 ...module.in => test-load-report-gnome-module.scm} |   0
 gnucash/report/report-system/CMakeLists.txt        |  14 -
 gnucash/report/report-system/html-barchart.scm     |   3 +
 gnucash/report/report-system/test/CMakeLists.txt   |  19 +-
 gnucash/report/report-system/test/Makefile.am      |   3 +-
 ...odule.in => test-load-report-system-module.scm} |   8 -
 gnucash/report/standard-reports/CMakeLists.txt     |   9 -
 .../report/standard-reports/test/CMakeLists.txt    |  27 +-
 gnucash/report/standard-reports/test/Makefile.am   |   4 +
 gnucash/report/stylesheets/CMakeLists.txt          |   9 -
 gnucash/report/stylesheets/test/CMakeLists.txt     |  26 +-
 gnucash/report/stylesheets/test/Makefile.am        |  15 +-
 ....in => test-load-report-stylesheets-module.scm} |  12 +-
 gnucash/report/utility-reports/CMakeLists.txt      |   8 -
 libgnucash/app-utils/CMakeLists.txt                |  15 -
 libgnucash/app-utils/test/CMakeLists.txt           |  34 +-
 libgnucash/app-utils/test/Makefile.am              |  15 +-
 ...ad-module.in => test-load-app-utils-module.scm} |   4 -
 libgnucash/backend/dbi/gnc-backend-dbi.cpp         |  31 +-
 libgnucash/backend/dbi/gnc-dbisqlresult.cpp        |  17 +-
 libgnucash/core-utils/CMakeLists.txt               |   6 -
 libgnucash/engine/CMakeLists.txt                   |   9 -
 libgnucash/engine/ScrubBusiness.c                  |   2 +-
 libgnucash/engine/Transaction.c                    |  63 +-
 libgnucash/engine/Transaction.h                    |  20 +-
 libgnucash/engine/gncOwner.c                       |   4 +-
 libgnucash/engine/test/CMakeLists.txt              |  41 +-
 libgnucash/engine/test/Makefile.am                 |   8 +-
 libgnucash/engine/test/test-create-account.in      |   2 -
 libgnucash/engine/test/test-scm-query-import.in    |   2 -
 libgnucash/gnc-module/CMakeLists.txt               |   8 +-
 libgnucash/gnc-module/test/CMakeLists.txt          |  67 +-
 libgnucash/gnc-module/test/Makefile.am             |  33 +-
 libgnucash/gnc-module/test/mod-baz/CMakeLists.txt  |   7 +
 libgnucash/gnc-module/test/mod-foo/CMakeLists.txt  |   7 +
 ...-load-deps.in => test-gnc-module-load-deps.scm} |   9 -
 ...st-load-scm.in => test-gnc-module-load-scm.scm} |   8 +-
 .../test/test-gnc-module-scm-dynload.scm           |   5 +
 ...st-scm-init.in => test-gnc-module-scm-init.scm} |  10 +-
 ...-load-scm.in => test-gnc-module-scm-module.scm} |  10 +-
 ...-scm-multi.in => test-gnc-module-scm-multi.scm} |  10 +-
 ...t-load-scm.in => test-gnc-module-swigged-c.scm} |   8 +-
 libgnucash/gnc-module/test/test-gwrapped-c.in      |  15 -
 libgnucash/gnc-module/test/test-scm-dynload.in     |  15 -
 libgnucash/gnc-module/test/test-scm-module.in      |  15 -
 libgnucash/scm/CMakeLists.txt                      |  13 +-
 libgnucash/scm/gnumeric/CMakeLists.txt             |  10 +-
 libgnucash/tax/us/CMakeLists.txt                   |   9 -
 libgnucash/tax/us/test/CMakeLists.txt              |  15 +-
 ...-load-module.in => test-load-tax-us-module.scm} |   4 -
 po/POTFILES.skip                                   |   1 +
 po/de.po                                           | 775 +++++++++++---------
 po/glossary/ar.po                                  |  24 +-
 po/glossary/bg.po                                  |  31 +-
 po/glossary/ca.po                                  |  33 +-
 po/glossary/da.po                                  |  31 +-
 po/glossary/de.po                                  |  33 +-
 po/glossary/de_CH.po                               |  31 +-
 po/glossary/el.po                                  |  31 +-
 po/glossary/es.po                                  |  31 +-
 po/glossary/fr.po                                  |  29 +-
 po/glossary/gnc-glossary.txt                       |   6 +-
 po/glossary/he.po                                  |  31 +-
 po/glossary/hu.po                                  |  31 +-
 po/glossary/it.po                                  |  31 +-
 po/glossary/lt.po                                  |  29 +-
 po/glossary/nb.po                                  |  31 +-
 po/glossary/nl.po                                  |  31 +-
 po/glossary/pl.po                                  |  31 +-
 po/glossary/pt.po                                  |  31 +-
 po/glossary/pt_BR.po                               |  31 +-
 po/glossary/ru.po                                  |  31 +-
 po/glossary/rw.po                                  |  26 +-
 po/glossary/sk.po                                  |  31 +-
 po/glossary/sv.po                                  |  31 +-
 po/glossary/vi.po                                  |  31 +-
 po/glossary/zh_CN.po                               |  41 +-
 po/glossary/zh_TW.po                               |  31 +-
 po/ru.po                                           |  99 +--
 133 files changed, 2945 insertions(+), 1871 deletions(-)
 rename gnucash/gnome-utils/test/{test-load-module.in => test-load-gnome-utils-module.scm} (89%)
 rename gnucash/report/locale-specific/us/test/{test-load-module.in => test-load-report-locale-specific-module.scm} (91%)
 rename gnucash/report/report-gnome/test/{test-load-module.in => test-load-report-gnome-module.scm} (100%)
 rename gnucash/report/report-system/test/{test-load-module.in => test-load-report-system-module.scm} (91%)
 rename gnucash/report/stylesheets/test/{test-load-module.in => test-load-report-stylesheets-module.scm} (92%)
 rename libgnucash/app-utils/test/{test-load-module.in => test-load-app-utils-module.scm} (97%)
 delete mode 100755 libgnucash/engine/test/test-create-account.in
 delete mode 100755 libgnucash/engine/test/test-scm-query-import.in
 rename libgnucash/gnc-module/test/{test-load-deps.in => test-gnc-module-load-deps.scm} (81%)
 copy libgnucash/gnc-module/test/{test-load-scm.in => test-gnc-module-load-scm.scm} (88%)
 create mode 100755 libgnucash/gnc-module/test/test-gnc-module-scm-dynload.scm
 rename libgnucash/gnc-module/test/{test-scm-init.in => test-gnc-module-scm-init.scm} (79%)
 copy libgnucash/gnc-module/test/{test-load-scm.in => test-gnc-module-scm-module.scm} (83%)
 rename libgnucash/gnc-module/test/{test-scm-multi.in => test-gnc-module-scm-multi.scm} (86%)
 rename libgnucash/gnc-module/test/{test-load-scm.in => test-gnc-module-swigged-c.scm} (88%)
 delete mode 100755 libgnucash/gnc-module/test/test-gwrapped-c.in
 delete mode 100755 libgnucash/gnc-module/test/test-scm-dynload.in
 delete mode 100755 libgnucash/gnc-module/test/test-scm-module.in
 rename libgnucash/tax/us/test/{test-load-module.in => test-load-tax-us-module.scm} (87%)



More information about the gnucash-changes mailing list