gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu May 25 10:47:38 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/23c208e1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ae9304ef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f9efbf86 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9748e6f3 (commit)



commit 23c208e1a0dd56d6962568642eb42dd57936b58c
Merge: 9748e6f3fb ae9304efb0
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu May 25 10:45:04 2023 -0400

    Merge Richard Cohen's 'remove-unused-value-list' into stable.


commit ae9304efb09c78a65baecd3a6fabfe8e7225c7a5
Author: Richard Cohen <richard at daijobu.co.uk>
Date:   Thu May 25 09:45:53 2023 +0100

    Remove unused boxed type gnc_value_list

diff --git a/libgnucash/engine/kvp-frame.cpp b/libgnucash/engine/kvp-frame.cpp
index c809a7cc07..2aa3535d7b 100644
--- a/libgnucash/engine/kvp-frame.cpp
+++ b/libgnucash/engine/kvp-frame.cpp
@@ -232,17 +232,6 @@ int compare(const KvpFrameImpl & one, const KvpFrameImpl & two) noexcept
     return 0;
 }
 
-static void
-kvp_value_list_from_gvalue (GValue *gval, gpointer pList)
-{
-    GList **kvplist = (GList**)pList;
-    KvpValue *kvp;
-    if (!(gval && G_VALUE_TYPE (gval)))
-        return;
-    kvp = kvp_value_from_gvalue (gval);
-    *kvplist = g_list_prepend (*kvplist, kvp);
-}
-
 GValue*
 gvalue_from_kvp_value (const KvpValue *kval, GValue* val)
 {
@@ -283,14 +272,12 @@ gvalue_from_kvp_value (const KvpValue *kval, GValue* val)
             g_value_set_static_boxed (val, kval->get_ptr<GDate>());
             break;
         case KvpValue::Type::GLIST:
-        {
-            g_value_init (val, GNC_TYPE_VALUE_LIST);
-            g_value_set_static_boxed (val, kval->get<GList*>());
-            break;
-        }
+            PWARN ("Error! Attempt to transfer KvpGList!");
+            [[fallthrough]];
 /* No transfer of KVP frames outside of QofInstance-derived classes! */
         case KvpValue::Type::FRAME:
             PWARN ("Error! Attempt to transfer KvpFrame!");
+            [[fallthrough]];
         default:
             PWARN ("Error! Invalid KVP Transfer Request!");
             g_slice_free (GValue, val);
@@ -338,68 +325,12 @@ kvp_value_from_gvalue (const GValue *gval)
         val = new KvpValue(*(Time64*)g_value_get_boxed (gval));
     else if (type == G_TYPE_DATE)
         val = new KvpValue(*(GDate*)g_value_get_boxed (gval));
-    else if (type == GNC_TYPE_VALUE_LIST)
-    {
-        GList *gvalue_list = (GList*)g_value_get_boxed (gval);
-        GList *kvp_list = NULL;
-        g_list_foreach (gvalue_list, (GFunc)kvp_value_list_from_gvalue,
-                        &kvp_list);
-        kvp_list = g_list_reverse (kvp_list);
-        val = new KvpValue(kvp_list);
-//      g_list_free_full (gvalue_list, (GDestroyNotify)g_value_unset);
-//      gvalue_list = NULL;
-    }
     else
         PWARN ("Error! Don't know how to make a KvpValue from a %s",
                G_VALUE_TYPE_NAME (gval));
 
     return val;
 }
-/* The following are required for using KvpValue GLists as GValues */
-static void
-gnc_gvalue_copy (GValue *src, gpointer uData)
-{
-    GList **new_list = (GList**)uData;
-    GValue *dest = g_value_init (g_slice_new0 (GValue), G_VALUE_TYPE (src));
-    g_value_copy (src, dest);
-    *new_list = g_list_prepend(*new_list, dest);
-}
-
-void
-gnc_gvalue_free (GValue *val)
-{
-    if (val == NULL || ! G_IS_VALUE (val)) return;
-    g_value_unset (val);
-    g_slice_free (GValue, val);
-}
-
-static GList*
-gnc_value_list_copy (GList *list)
-{
-    GList *new_list = NULL;
-    g_list_foreach (list, (GFunc)gnc_gvalue_copy, &new_list);
-    new_list = g_list_reverse (new_list);
-    return new_list;
-}
-
-static void
-gnc_value_list_free (GList *list)
-{
-    g_list_free_full (list, (GDestroyNotify)gnc_gvalue_free);
-}
-
-GType
-gnc_value_list_get_type (void)
-{
-    static GType type = 0;
-    if (type == 0)
-    {
-        type = g_boxed_type_register_static ("gnc_value_list",
-                                             (GBoxedCopyFunc)gnc_value_list_copy,
-                                             (GBoxedFreeFunc)gnc_value_list_free);
-    }
-    return type;
-}
 
 void
 KvpFrame::flatten_kvp_impl(std::vector <std::string> path, std::vector <KvpEntry> & entries) const noexcept
diff --git a/libgnucash/engine/kvp-value.hpp b/libgnucash/engine/kvp-value.hpp
index b61f98911c..e3f4f9cd8b 100644
--- a/libgnucash/engine/kvp-value.hpp
+++ b/libgnucash/engine/kvp-value.hpp
@@ -185,15 +185,7 @@ GValue* gvalue_from_kvp_value (const KvpValue *kval, GValue* val = nullptr);
  */
 KvpValue* kvp_value_from_gvalue (const GValue *gval);
 
-/**
- * \brief Convenience function to release the value in a GValue
- * acquired by kvp_frame_get_gvalue and to free the GValue.
- * \param value: A GValue* created by kvp_frame_get_gvalue
- */
-void gnc_gvalue_free (GValue *value);
 /** @} Close Doxygen Internal */
 /** @} Close Doxygen Group */
-extern "C" GType gnc_value_list_get_type (void);
-#define GNC_TYPE_VALUE_LIST (gnc_value_list_get_type ())
 
 #endif

commit f9efbf86c67d72ae06ba77dd92dfebcf517e1aea
Author: Richard Cohen <richard at daijobu.co.uk>
Date:   Thu May 25 09:34:17 2023 +0100

    Remove unused Qofbook::ab-templates property

diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index aae4cc6cf8..a049535dec 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -59,8 +59,6 @@
 #include "qofbook.hpp"
 
 static QofLogModule log_module = QOF_MOD_ENGINE;
-#define AB_KEY "hbci"
-#define AB_TEMPLATES "template-list"
 
 enum
 {
@@ -72,7 +70,6 @@ enum
     PROP_OPT_NUM_FIELD_SOURCE,              /* KVP */
     PROP_OPT_DEFAULT_BUDGET,                /* KVP */
     PROP_OPT_FY_END,                        /* KVP */
-    PROP_AB_TEMPLATES,                      /* KVP */
 };
 
 static void
@@ -180,9 +177,6 @@ qof_book_get_property (GObject* object,
     case PROP_OPT_FY_END:
         qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {"fy_end"});
         break;
-    case PROP_AB_TEMPLATES:
-          qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {"AB_KEY", "AB_TEMPLATES"});
-        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -222,9 +216,6 @@ qof_book_set_property (GObject      *object,
     case PROP_OPT_FY_END:
         qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {"fy_end"});
         break;
-    case PROP_AB_TEMPLATES:
-        qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {AB_KEY, AB_TEMPLATES});
-        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -290,14 +281,6 @@ qof_book_class_init (QofBookClass *klass)
                         "Day of the Fiscal year for the book.",
                         G_TYPE_DATE,
                         G_PARAM_READWRITE));
-    g_object_class_install_property
-    (gobject_class,
-     PROP_AB_TEMPLATES,
-     g_param_spec_boxed("ab-templates",
-                        "AQBanking Template List",
-                        "A GList of AQBanking Templates",
-                        GNC_TYPE_VALUE_LIST,
-                        G_PARAM_READWRITE));
 }
 
 QofBook *



Summary of changes:
 libgnucash/engine/kvp-frame.cpp | 75 ++---------------------------------------
 libgnucash/engine/kvp-value.hpp |  8 -----
 libgnucash/engine/qofbook.cpp   | 17 ----------
 3 files changed, 3 insertions(+), 97 deletions(-)



More information about the gnucash-changes mailing list