gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Fri Oct 29 09:13:41 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/f813f7cd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0a39c37b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/deec353b (commit)
	from  https://github.com/Gnucash/gnucash/commit/d6ad50df (commit)



commit f813f7cd1463711587b09482357b1c9559fc8619
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Oct 25 06:33:12 2021 +0800

    [gnc-autoclear] Move autoclear algorithm into gnome-utils

diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
index 4bead2db2..d6b570ab7 100644
--- a/gnucash/gnome-utils/CMakeLists.txt
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -47,6 +47,7 @@ set (gnome_utils_SOURCES
   dialog-utils.c
   gnc-account-sel.c
   gnc-amount-edit.c
+  gnc-autoclear.c
   gnc-autosave.c
   gnc-cell-renderer-date.c
   gnc-cell-renderer-popup.c
diff --git a/gnucash/gnome-utils/gnc-autoclear.c b/gnucash/gnome-utils/gnc-autoclear.c
new file mode 100644
index 000000000..267a16545
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-autoclear.c
@@ -0,0 +1,190 @@
+/********************************************************************
+ * gnc-autoclear.c -- Knapsack algorithm functions                  *
+ *                                                                  *
+ * Copyright 2020 Cristian Klein <cristian at kleinlabs.eu>            *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+ *******************************************************************/
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "Account.h"
+#include "Split.h"
+#include "gncOwner.h"
+#include "qof.h"
+#include "gnc-autoclear.h"
+
+static QofLogModule log_module = GNC_MOD_GUI;
+
+/* the following functions are used in window-autoclear: */
+
+#define MAXIMUM_SACK_SIZE 1000000
+
+static gboolean
+ght_gnc_numeric_equal(gconstpointer v1, gconstpointer v2)
+{
+    gnc_numeric n1 = *(gnc_numeric *)v1, n2 = *(gnc_numeric *)v2;
+    return gnc_numeric_equal(n1, n2);
+}
+
+static guint
+ght_gnc_numeric_hash(gconstpointer v1)
+{
+    gnc_numeric n1 = *(gnc_numeric *)v1;
+    gdouble d1 = gnc_numeric_to_double(n1);
+    return g_double_hash (&d1);
+}
+
+typedef struct _sack_foreach_data_t
+{
+    gnc_numeric split_value;
+    GList *reachable_list;
+} *sack_foreach_data_t;
+
+static void sack_foreach_func(gpointer key, gpointer value, gpointer user_data)
+{
+    sack_foreach_data_t data = (sack_foreach_data_t) user_data;
+    gnc_numeric thisvalue = *(gnc_numeric *) key;
+    gnc_numeric reachable_value = gnc_numeric_add_fixed (thisvalue, data->split_value);
+    gpointer new_value = g_malloc(sizeof(gnc_numeric));
+
+    memcpy(new_value, &reachable_value, sizeof(gnc_numeric));
+    data->reachable_list = g_list_prepend(data->reachable_list, new_value);
+}
+
+GList *
+gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
+                                  gchar **errmsg)
+{
+    GList *nc_list = NULL, *toclear_list = NULL;
+    GHashTable *sack;
+    gchar *msg = NULL;
+    guint sack_size = 0;
+
+    g_return_val_if_fail (GNC_IS_ACCOUNT (account), NULL);
+
+    sack = g_hash_table_new_full (ght_gnc_numeric_hash, ght_gnc_numeric_equal,
+                                  g_free, NULL);
+
+    /* Extract which splits are not cleared and compute the amount we have to clear */
+    for (GList *node = xaccAccountGetSplitList (account); node; node = node->next)
+    {
+        Split *split = (Split *)node->data;
+
+        if (xaccSplitGetReconcile (split) == NREC)
+            nc_list = g_list_prepend (nc_list, split);
+        else
+            toclear_value = gnc_numeric_sub_fixed
+                (toclear_value, xaccSplitGetAmount (split));
+    }
+
+    if (gnc_numeric_zero_p (toclear_value))
+    {
+        msg = _("Account is already at Auto-Clear Balance.");
+        goto skip_knapsack;
+    }
+
+    /* Run knapsack */
+    /* Entries in the hash table are:
+     *  - key   = amount to which we know how to clear (freed by GHashTable)
+     *  - value = last split we used to clear this amount (not managed by GHashTable)
+     */
+    for (GList *node = nc_list; node; node = node->next)
+    {
+        Split *split = (Split *)node->data;
+        gnc_numeric split_value = xaccSplitGetAmount (split);
+        gpointer new_value = g_malloc(sizeof(gnc_numeric));
+
+        struct _sack_foreach_data_t s_data[1];
+        s_data->split_value = split_value;
+        s_data->reachable_list = NULL;
+
+        /* For each value in the sack, compute a new reachable value */
+        g_hash_table_foreach (sack, sack_foreach_func, s_data);
+
+        /* Add the value of the split itself to the reachable_list */
+        memcpy(new_value, &split_value, sizeof(gnc_numeric));
+        s_data->reachable_list = g_list_prepend
+            (s_data->reachable_list, new_value);
+
+        /* Add everything to the sack, looking out for duplicates */
+        for (GList *s_node = s_data->reachable_list; s_node; s_node = s_node->next)
+        {
+            gnc_numeric *reachable_value = s_node->data;
+
+            /* Check if it already exists */
+            if (g_hash_table_lookup_extended (sack, reachable_value, NULL, NULL))
+            {
+                /* If yes, we are in trouble, we reached an amount
+                   using two solutions */
+                g_hash_table_insert (sack, reachable_value, NULL);
+            }
+            else
+            {
+                g_hash_table_insert (sack, reachable_value, split);
+                sack_size++;
+
+                if (sack_size > MAXIMUM_SACK_SIZE)
+                {
+                    msg = _("Too many uncleared splits");
+                    goto skip_knapsack;
+                }
+            }
+        }
+        g_list_free (s_data->reachable_list);
+    }
+
+    /* Check solution */
+    while (!gnc_numeric_zero_p (toclear_value))
+    {
+        Split *split = NULL;
+
+        if (!g_hash_table_lookup_extended (sack, &toclear_value,
+                                           NULL, (gpointer) &split))
+        {
+            msg = _("The selected amount cannot be cleared.");
+            goto skip_knapsack;
+        }
+
+        if (!split)
+        {
+            msg = _("Cannot uniquely clear splits. Found multiple possibilities.");
+            goto skip_knapsack;
+        }
+
+        toclear_list = g_list_prepend (toclear_list, split);
+        toclear_value = gnc_numeric_sub_fixed (toclear_value,
+                                               xaccSplitGetAmount (split));
+    }
+
+ skip_knapsack:
+    g_hash_table_destroy (sack);
+    g_list_free (nc_list);
+
+    if (msg)
+    {
+        *errmsg = g_strdup (msg);
+        g_list_free (toclear_list);
+        return NULL;
+    }
+
+    *errmsg = NULL;
+    return toclear_list;
+}
diff --git a/gnucash/gnome-utils/gnc-autoclear.h b/gnucash/gnome-utils/gnc-autoclear.h
new file mode 100644
index 000000000..1896c2c05
--- /dev/null
+++ b/gnucash/gnome-utils/gnc-autoclear.h
@@ -0,0 +1,39 @@
+/********************************************************************
+ * gnc-autoclear.h -- Knapsack algorithm functions
+ *
+ * Copyright 2020 Cristian Klein <cristian at kleinlabs.eu>
+ *
+ * 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  02111-1301,  USA       gnu at gnu.org
+ *******************************************************************/
+
+#ifndef GNC_AUTOCLEAR_H
+#define GNC_AUTOCLEAR_H
+
+#include <glib.h>
+#include <Account.h>
+
+/** Account splits are analysed; attempts to find a unique combination
+ *  of uncleared splits which would set cleared balance to
+ *  toclear_value. If this is not possible, *errmsg will be error
+ *  message. errmsg must be a pointer to a gchar. If it is set, it
+ *  must be freed by the caller.
+ */
+GList * gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
+                                          gchar **errmsg);
+
+#endif
diff --git a/gnucash/gnome-utils/test/CMakeLists.txt b/gnucash/gnome-utils/test/CMakeLists.txt
index b037b854d..207830aa6 100644
--- a/gnucash/gnome-utils/test/CMakeLists.txt
+++ b/gnucash/gnome-utils/test/CMakeLists.txt
@@ -29,7 +29,29 @@ gnc_add_scheme_test_targets(scm-test-load-gnome-utils-module
     OUTPUT_DIR "tests"
     DEPENDS "${GUILE_DEPENDS}")
 
+set(test_autoclear_SOURCES
+  test-autoclear.cpp
+)
+
+set(test_autoclear_INCLUDE_DIRS
+  ${CMAKE_BINARY_DIR}/common
+  ${CMAKE_SOURCE_DIR}/libgnucash/engine
+  ${GLIB2_INCLUDE_DIRS}
+)
+
+set(test_autoclear_LIBS
+  gnc-engine
+  gnc-gnome-utils
+  gtest
+)
+
+gnc_add_test(test-autoclear "${test_autoclear_SOURCES}"
+    test_autoclear_INCLUDE_DIRS
+    test_autoclear_LIBS
+)
+
 gnc_add_scheme_tests(test-load-gnome-utils-module.scm)
 
 
-set_dist_list(test_gnome_utils_DIST CMakeLists.txt test-gnc-recurrence.c test-load-gnome-utils-module.scm)
+set_dist_list(test_gnome_utils_DIST CMakeLists.txt test-gnc-recurrence.c test-load-gnome-utils-module.scm
+  ${test_autoclear_SOURCES})
diff --git a/libgnucash/app-utils/test/test-autoclear.cpp b/gnucash/gnome-utils/test/test-autoclear.cpp
similarity index 99%
rename from libgnucash/app-utils/test/test-autoclear.cpp
rename to gnucash/gnome-utils/test/test-autoclear.cpp
index 1dad9e488..fd9799148 100644
--- a/libgnucash/app-utils/test/test-autoclear.cpp
+++ b/gnucash/gnome-utils/test/test-autoclear.cpp
@@ -25,9 +25,10 @@
 #include <glib.h>
 // GoogleTest is written in C++, however, the function we test in C.
 extern "C" {
-#include "../gnc-ui-balances.h"
+#include "../gnc-autoclear.h"
 }
 #include <memory>
+#include <Account.h>
 #include <Split.h>
 #include <gtest/gtest.h>
 
diff --git a/gnucash/gnome/window-autoclear.c b/gnucash/gnome/window-autoclear.c
index e03b390a1..4c17cbad1 100644
--- a/gnucash/gnome/window-autoclear.c
+++ b/gnucash/gnome/window-autoclear.c
@@ -32,7 +32,7 @@
 #include "gnc-main-window.h"
 #include "gnc-plugin-page-register.h"
 #include "gnc-ui.h"
-#include "gnc-ui-balances.h"
+#include "gnc-autoclear.h"
 #include "window-autoclear.h"
 
 #define WINDOW_AUTOCLEAR_CM_CLASS "window-autoclear"
diff --git a/libgnucash/app-utils/gnc-ui-balances.c b/libgnucash/app-utils/gnc-ui-balances.c
index a948ecc79..b46b53199 100644
--- a/libgnucash/app-utils/gnc-ui-balances.c
+++ b/libgnucash/app-utils/gnc-ui-balances.c
@@ -341,159 +341,3 @@ gnc_ui_owner_get_print_report_balance (GncOwner *owner,
     return g_strdup (xaccPrintAmount (balance, print_info));
 }
 
-
-/* the following functions are used in window-autoclear: */
-
-#define MAXIMUM_SACK_SIZE 1000000
-
-static gboolean
-ght_gnc_numeric_equal(gconstpointer v1, gconstpointer v2)
-{
-    gnc_numeric n1 = *(gnc_numeric *)v1, n2 = *(gnc_numeric *)v2;
-    return gnc_numeric_equal(n1, n2);
-}
-
-static guint
-ght_gnc_numeric_hash(gconstpointer v1)
-{
-    gnc_numeric n1 = *(gnc_numeric *)v1;
-    gdouble d1 = gnc_numeric_to_double(n1);
-    return g_double_hash (&d1);
-}
-
-typedef struct _sack_foreach_data_t
-{
-    gnc_numeric split_value;
-    GList *reachable_list;
-} *sack_foreach_data_t;
-
-static void sack_foreach_func(gpointer key, gpointer value, gpointer user_data)
-{
-    sack_foreach_data_t data = (sack_foreach_data_t) user_data;
-    gnc_numeric thisvalue = *(gnc_numeric *) key;
-    gnc_numeric reachable_value = gnc_numeric_add_fixed (thisvalue, data->split_value);
-    gpointer new_value = g_malloc(sizeof(gnc_numeric));
-
-    memcpy(new_value, &reachable_value, sizeof(gnc_numeric));
-    data->reachable_list = g_list_prepend(data->reachable_list, new_value);
-}
-
-GList *
-gnc_account_get_autoclear_splits (Account *account, gnc_numeric toclear_value,
-                                  gchar **errmsg)
-{
-    GList *nc_list = NULL, *toclear_list = NULL;
-    GHashTable *sack;
-    gchar *msg = NULL;
-    guint sack_size = 0;
-
-    g_return_val_if_fail (GNC_IS_ACCOUNT (account), NULL);
-
-    sack = g_hash_table_new_full (ght_gnc_numeric_hash, ght_gnc_numeric_equal,
-                                  g_free, NULL);
-
-    /* Extract which splits are not cleared and compute the amount we have to clear */
-    for (GList *node = xaccAccountGetSplitList (account); node; node = node->next)
-    {
-        Split *split = (Split *)node->data;
-
-        if (xaccSplitGetReconcile (split) == NREC)
-            nc_list = g_list_prepend (nc_list, split);
-        else
-            toclear_value = gnc_numeric_sub_fixed
-                (toclear_value, xaccSplitGetAmount (split));
-    }
-
-    if (gnc_numeric_zero_p (toclear_value))
-    {
-        msg = _("Account is already at Auto-Clear Balance.");
-        goto skip_knapsack;
-    }
-
-    /* Run knapsack */
-    /* Entries in the hash table are:
-     *  - key   = amount to which we know how to clear (freed by GHashTable)
-     *  - value = last split we used to clear this amount (not managed by GHashTable)
-     */
-    for (GList *node = nc_list; node; node = node->next)
-    {
-        Split *split = (Split *)node->data;
-        gnc_numeric split_value = xaccSplitGetAmount (split);
-        gpointer new_value = g_malloc(sizeof(gnc_numeric));
-
-        struct _sack_foreach_data_t s_data[1];
-        s_data->split_value = split_value;
-        s_data->reachable_list = NULL;
-
-        /* For each value in the sack, compute a new reachable value */
-        g_hash_table_foreach (sack, sack_foreach_func, s_data);
-
-        /* Add the value of the split itself to the reachable_list */
-        memcpy(new_value, &split_value, sizeof(gnc_numeric));
-        s_data->reachable_list = g_list_prepend
-            (s_data->reachable_list, new_value);
-
-        /* Add everything to the sack, looking out for duplicates */
-        for (GList *s_node = s_data->reachable_list; s_node; s_node = s_node->next)
-        {
-            gnc_numeric *reachable_value = s_node->data;
-
-            /* Check if it already exists */
-            if (g_hash_table_lookup_extended (sack, reachable_value, NULL, NULL))
-            {
-                /* If yes, we are in trouble, we reached an amount
-                   using two solutions */
-                g_hash_table_insert (sack, reachable_value, NULL);
-            }
-            else
-            {
-                g_hash_table_insert (sack, reachable_value, split);
-                sack_size++;
-
-                if (sack_size > MAXIMUM_SACK_SIZE)
-                {
-                    msg = _("Too many uncleared splits");
-                    goto skip_knapsack;
-                }
-            }
-        }
-        g_list_free (s_data->reachable_list);
-    }
-
-    /* Check solution */
-    while (!gnc_numeric_zero_p (toclear_value))
-    {
-        Split *split = NULL;
-
-        if (!g_hash_table_lookup_extended (sack, &toclear_value,
-                                           NULL, (gpointer) &split))
-        {
-            msg = _("The selected amount cannot be cleared.");
-            goto skip_knapsack;
-        }
-
-        if (!split)
-        {
-            msg = _("Cannot uniquely clear splits. Found multiple possibilities.");
-            goto skip_knapsack;
-        }
-
-        toclear_list = g_list_prepend (toclear_list, split);
-        toclear_value = gnc_numeric_sub_fixed (toclear_value,
-                                               xaccSplitGetAmount (split));
-    }
-
- skip_knapsack:
-    g_hash_table_destroy (sack);
-    g_list_free (nc_list);
-
-    if (msg)
-    {
-        *errmsg = g_strdup (msg);
-        g_list_free (toclear_list);
-        return NULL;
-    }
-
-    *errmsg = NULL;
-    return toclear_list;
-}
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index e92468496..77ba83976 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -71,23 +71,6 @@ endif()
 # 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)
 
-set(test_autoclear_SOURCES
-    test-autoclear.cpp
-)
-set(test_autoclear_INCLUDE_DIRS
-    ${APP_UTILS_TEST_INCLUDE_DIRS}
-    ${GTEST_INCLUDE_DIR}
-)
-set(test_autoclear_LIBS
-    ${APP_UTILS_TEST_LIBS}
-    gtest
-)
-
-gnc_add_test(test-autoclear "${test_autoclear_SOURCES}"
-    test_autoclear_INCLUDE_DIRS
-    test_autoclear_LIBS
-)
-
 set_dist_list(test_app_utils_DIST
   CMakeLists.txt
   test-exp-parser.c
@@ -100,5 +83,4 @@ set_dist_list(test_app_utils_DIST
   test-options.scm
   ${test_app_utils_scheme_SOURCES}
   ${test_app_utils_SOURCES}
-  ${test_autoclear_SOURCES}
 )
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 069809869..365d56798 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -147,6 +147,7 @@ gnucash/gnome-utils/dialog-userpass.c
 gnucash/gnome-utils/dialog-utils.c
 gnucash/gnome-utils/gnc-account-sel.c
 gnucash/gnome-utils/gnc-amount-edit.c
+gnucash/gnome-utils/gnc-autoclear.c
 gnucash/gnome-utils/gnc-autosave.c
 gnucash/gnome-utils/gnc-cell-renderer-date.c
 gnucash/gnome-utils/gnc-cell-renderer-popup.c

commit 0a39c37b22870c9ca65759155e24ab77b629e0cf
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Oct 27 09:18:38 2021 +0800

    [window-autoclear.glade] upgrade to glade 3.38.2

diff --git a/gnucash/gtkbuilder/window-autoclear.glade b/gnucash/gtkbuilder/window-autoclear.glade
index 335ed8c2a..74c5f8df8 100644
--- a/gnucash/gtkbuilder/window-autoclear.glade
+++ b/gnucash/gtkbuilder/window-autoclear.glade
@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
 <interface>
   <requires lib="gtk+" version="3.22"/>
   <object class="GtkDialog" id="auto_clear_start_dialog">
-    <property name="can_focus">False</property>
+    <property name="can-focus">False</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
+    <property name="type-hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox6">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">3</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area6">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
+            <property name="can-focus">False</property>
+            <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" id="cancel_button">
                 <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>
+                <property name="can-focus">True</property>
+                <property name="can-default">True</property>
+                <property name="receives-default">False</property>
+                <property name="use-underline">True</property>
                 <signal name="clicked" handler="gnc_autoclear_window_cancel_cb" swapped="no"/>
               </object>
               <packing>
@@ -37,11 +37,11 @@
               <object class="GtkButton" id="ok_button">
                 <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">True</property>
-                <property name="use_underline">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="gnc_autoclear_window_ok_cb" swapped="no"/>
               </object>
               <packing>
@@ -54,20 +54,20 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
+            <property name="pack-type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="vbox1">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="label" translatable="yes">About Auto-Clear</property>
                 <style>
                   <class name="gnc-class-title"/>
@@ -82,10 +82,10 @@
             <child>
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="label" translatable="yes">Use this dialog if you want GnuCash to automatically find which transactions are cleared, given an ending balance. For example, said ending balance can be the current balance given by your bank online.</property>
                 <property name="wrap">True</property>
-                <property name="max_width_chars">80</property>
+                <property name="max-width-chars">80</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -96,8 +96,8 @@
             <child>
               <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="has_tooltip">True</property>
+                <property name="can-focus">False</property>
+                <property name="has-tooltip">True</property>
                 <property name="label" translatable="yes">Caution!</property>
                 <style>
                   <class name="gnc-class-emphasis"/>
@@ -112,10 +112,10 @@
             <child>
               <object class="GtkLabel" id="label4">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="label" translatable="yes">This tool might be slow or abort if the number of uncleared splits is more than approximately 20. In that case please clear at least some of them manually.</property>
                 <property name="wrap">True</property>
-                <property name="max_width_chars">80</property>
+                <property name="max-width-chars">80</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -124,47 +124,63 @@
               </packing>
             </child>
             <child>
+              <!-- n-columns=3 n-rows=3 -->
               <object class="GtkGrid" id="table1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">6</property>
-                <property name="row_spacing">6</property>
-                <property name="column_spacing">6</property>
+                <property name="can-focus">False</property>
+                <property name="border-width">6</property>
+                <property name="row-spacing">6</property>
+                <property name="column-spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="end_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="halign">end</property>
                     <property name="label" translatable="yes">_Ending Balance</property>
-                    <property name="use_underline">True</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkBox" id="end_value_box">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="hexpand">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="status_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">1</property>
                     <property name="width">2</property>
                   </packing>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -176,11 +192,11 @@
               <object class="GtkCheckButton" id="show_cleared_splits_button">
                 <property name="label" translatable="yes">_Review cleared splits</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip_text" translatable="yes">Select this option to open a register tab with newly cleared splits.</property>
-                <property name="use_underline">True</property>
-                <property name="draw_indicator">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <property name="tooltip-text" translatable="yes">Select this option to open a register tab with newly cleared splits.</property>
+                <property name="use-underline">True</property>
+                <property name="draw-indicator">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -202,8 +218,5 @@
       <action-widget response="-6">cancel_button</action-widget>
       <action-widget response="-5">ok_button</action-widget>
     </action-widgets>
-    <child type="titlebar">
-      <placeholder/>
-    </child>
   </object>
 </interface>

commit deec353b3302da0bc262310d9e5c32c52b367645
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Oct 26 21:14:43 2021 +0800

    [window-reconcile.glade] upgrade to glade 3.38.2

diff --git a/gnucash/gtkbuilder/window-reconcile.glade b/gnucash/gtkbuilder/window-reconcile.glade
index b38d0fd6a..972759b92 100644
--- a/gnucash/gtkbuilder/window-reconcile.glade
+++ b/gnucash/gtkbuilder/window-reconcile.glade
@@ -1,29 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
 <interface>
   <requires lib="gtk+" version="3.22"/>
   <object class="GtkDialog" id="reconcile_start_dialog">
-    <property name="can_focus">False</property>
+    <property name="can-focus">False</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
+    <property name="type-hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox6">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area6">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</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>
+                <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>
@@ -35,11 +35,11 @@
               <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>
+                <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>
@@ -51,25 +51,25 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
+            <property name="pack-type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="vbox1">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="orientation">vertical</property>
             <property name="spacing">3</property>
             <child>
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="halign">start</property>
-                <property name="margin_start">6</property>
-                <property name="margin_end">6</property>
+                <property name="margin-start">6</property>
+                <property name="margin-end">6</property>
                 <property name="label" translatable="yes"><b>Reconcile Information</b></property>
-                <property name="use_markup">True</property>
+                <property name="use-markup">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -78,106 +78,107 @@
               </packing>
             </child>
             <child>
+              <!-- n-columns=3 n-rows=4 -->
               <object class="GtkGrid" id="table1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">6</property>
-                <property name="row_spacing">3</property>
-                <property name="column_spacing">6</property>
+                <property name="can-focus">False</property>
+                <property name="border-width">6</property>
+                <property name="row-spacing">3</property>
+                <property name="column-spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="date_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="halign">end</property>
                     <property name="label" translatable="yes">Statement _Date</property>
-                    <property name="use_underline">True</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="start_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="halign">end</property>
                     <property name="label" translatable="yes">Starting Balance</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">1</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="end_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="halign">end</property>
                     <property name="label" translatable="yes">_Ending Balance</property>
-                    <property name="use_underline">True</property>
+                    <property name="use-underline">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">2</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkCheckButton" id="subaccount_check">
                     <property name="label" translatable="yes">Include _subaccounts</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Include all descendant accounts in the reconcile. All of them must use the same commodity as this one.</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="tooltip-text" translatable="yes">Include all descendant accounts in the reconcile. All of them must use the same commodity as this one.</property>
+                    <property name="use-underline">True</property>
+                    <property name="draw-indicator">True</property>
                     <signal name="toggled" handler="gnc_start_recn_children_changed" swapped="no"/>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">3</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkBox" id="date_value_box">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <child>
                       <placeholder/>
                     </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkBox" id="ending_value_box">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <child>
                       <placeholder/>
                     </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">2</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="hexpand">True</property>
                     <child>
                       <object class="GtkLabel" id="start_value">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can-focus">False</property>
                         <property name="halign">start</property>
-                        <property name="margin_start">3</property>
-                        <property name="margin_end">3</property>
-                        <property name="margin_top">3</property>
-                        <property name="margin_bottom">3</property>
+                        <property name="margin-start">3</property>
+                        <property name="margin-end">3</property>
+                        <property name="margin-top">3</property>
+                        <property name="margin-bottom">3</property>
                         <property name="label">$15.00</property>
                       </object>
                       <packing>
@@ -191,13 +192,25 @@
                     </style>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
+                    <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>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -208,15 +221,15 @@
             <child>
               <object class="GtkButtonBox" id="hbuttonbox1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <child>
                   <object class="GtkButton" id="interest_button">
                     <property name="label" translatable="yes">Enter _Interest Payment...</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="border_width">8</property>
-                    <property name="use_underline">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="border-width">8</property>
+                    <property name="use-underline">True</property>
                     <signal name="clicked" handler="gnc_start_recn_interest_clicked_cb" swapped="no"/>
                   </object>
                   <packing>
@@ -234,13 +247,13 @@
             </child>
             <child>
               <object class="GtkBox" id="future_warning">
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="halign">center</property>
                 <child>
                   <object class="GtkImage" id="future_icon">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="icon_name">dialog-warning</property>
+                    <property name="can-focus">False</property>
+                    <property name="icon-name">dialog-warning</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -251,9 +264,9 @@
                 <child>
                   <object class="GtkLabel" id="future_text">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="margin_start">3</property>
-                    <property name="margin_end">3</property>
+                    <property name="can-focus">False</property>
+                    <property name="margin-start">3</property>
+                    <property name="margin-end">3</property>
                     <property name="label" translatable="yes">Statement Date is after today</property>
                     <property name="wrap">True</property>
                   </object>
@@ -284,8 +297,5 @@
       <action-widget response="-6">cancelbutton1</action-widget>
       <action-widget response="-5">okbutton1</action-widget>
     </action-widgets>
-    <child type="titlebar">
-      <placeholder/>
-    </child>
   </object>
 </interface>



Summary of changes:
 gnucash/gnome-utils/CMakeLists.txt                 |   1 +
 gnucash/gnome-utils/gnc-autoclear.c                | 190 +++++++++++++++++++++
 .../gnome-utils/gnc-autoclear.h                    |  27 ++-
 gnucash/gnome-utils/test/CMakeLists.txt            |  24 ++-
 .../gnome-utils}/test/test-autoclear.cpp           |   3 +-
 gnucash/gnome/window-autoclear.c                   |   2 +-
 gnucash/gtkbuilder/window-autoclear.glade          | 105 +++++++-----
 gnucash/gtkbuilder/window-reconcile.glade          | 152 +++++++++--------
 libgnucash/app-utils/gnc-ui-balances.c             | 156 -----------------
 libgnucash/app-utils/test/CMakeLists.txt           |  18 --
 po/POTFILES.in                                     |   1 +
 11 files changed, 376 insertions(+), 303 deletions(-)
 create mode 100644 gnucash/gnome-utils/gnc-autoclear.c
 copy libgnucash/tax/gnc-locale-tax.h => gnucash/gnome-utils/gnc-autoclear.h (55%)
 rename {libgnucash/app-utils => gnucash/gnome-utils}/test/test-autoclear.cpp (99%)



More information about the gnucash-changes mailing list