gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Jun 23 19:18:22 EDT 2026
Updated via https://github.com/Gnucash/gnucash/commit/dc03a84c (commit)
via https://github.com/Gnucash/gnucash/commit/fab8a352 (commit)
from https://github.com/Gnucash/gnucash/commit/7ad932a1 (commit)
commit dc03a84c337554b1abdad837a231b270b6af2305
Merge: 7ad932a1a2 fab8a3520a
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Jun 23 16:15:03 2026 -0700
Merge Christopher Lam's 'qof-ctor-dtor' into stable.
commit fab8a3520aa76ae4e0736d2a91686aeaf3a8b1b9
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Jun 14 10:38:19 2026 +0800
eradicate QOF_TYPE_COLLECT
it's unused...
diff --git a/libgnucash/engine/gncInvoice.c b/libgnucash/engine/gncInvoice.c
index 15c1cf6959..bd2aaba6d1 100644
--- a/libgnucash/engine/gncInvoice.c
+++ b/libgnucash/engine/gncInvoice.c
@@ -1184,60 +1184,6 @@ GNCPrice * gncInvoiceGetPrice (GncInvoice *invoice, gnc_commodity *commodity)
return NULL;
}
-static QofCollection*
-qofInvoiceGetEntries (GncInvoice *invoice)
-{
- QofCollection *entry_coll;
- GList *list;
- QofInstance *entry;
-
- entry_coll = qof_collection_new (GNC_ID_ENTRY);
- for (list = gncInvoiceGetEntries (invoice); list != NULL; list = list->next)
- {
- entry = QOF_INSTANCE(list->data);
- qof_collection_add_entity (entry_coll, entry);
- }
- return entry_coll;
-}
-
-static void
-qofInvoiceEntryCB (QofInstance *ent, gpointer user_data)
-{
- GncInvoice *invoice;
-
- invoice = (GncInvoice*)user_data;
- if (!invoice || !ent)
- {
- return;
- }
- switch (gncInvoiceGetOwnerType (invoice))
- {
- case GNC_OWNER_VENDOR:
- {
- gncBillAddEntry (invoice, (GncEntry*) ent);
- break;
- }
- default :
- {
- gncInvoiceAddEntry (invoice, (GncEntry*)ent);
- break;
- }
- }
-}
-
-static void
-qofInvoiceSetEntries (GncInvoice *invoice, QofCollection *entry_coll)
-{
- if (!entry_coll)
- {
- return;
- }
- if (0 == g_strcmp0 (qof_collection_get_type (entry_coll), GNC_ID_ENTRY))
- {
- qof_collection_foreach (entry_coll, qofInvoiceEntryCB, invoice);
- }
-}
-
static GncJob*
qofInvoiceGetJob (const GncInvoice *invoice)
{
@@ -2284,7 +2230,6 @@ gboolean gncInvoiceRegister (void)
{ INVOICE_TYPE_STRING, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetTypeString, NULL },
{ INVOICE_TERMS, GNC_ID_BILLTERM, (QofAccessFunc)gncInvoiceGetTerms, (QofSetterFunc)gncInvoiceSetTerms },
{ INVOICE_BILLTO, GNC_ID_OWNER, (QofAccessFunc)gncInvoiceGetBillTo, NULL },
- { INVOICE_ENTRIES, QOF_TYPE_COLLECT, (QofAccessFunc)qofInvoiceGetEntries, (QofSetterFunc)qofInvoiceSetEntries },
{ INVOICE_JOB, GNC_ID_JOB, (QofAccessFunc)qofInvoiceGetJob, (QofSetterFunc)qofInvoiceSetJob },
{ QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceGetActive, (QofSetterFunc)gncInvoiceSetActive },
{ INVOICE_IS_CN, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceGetIsCreditNote, (QofSetterFunc)gncInvoiceSetIsCreditNote },
@@ -2300,8 +2245,6 @@ gboolean gncInvoiceRegister (void)
/* Make the compiler happy... */
if (0)
{
- qofInvoiceSetEntries (NULL, NULL);
- qofInvoiceGetEntries (NULL);
qofInvoiceSetOwner (NULL, NULL);
qofInvoiceGetOwner (NULL);
qofInvoiceSetBillTo (NULL, NULL);
diff --git a/libgnucash/engine/gncInvoice.h b/libgnucash/engine/gncInvoice.h
index 3a5f71d6e8..aa2ac97aaa 100644
--- a/libgnucash/engine/gncInvoice.h
+++ b/libgnucash/engine/gncInvoice.h
@@ -303,7 +303,6 @@ gboolean gncInvoiceIsPaid (const GncInvoice *invoice);
#define INVOICE_TYPE "type"
#define INVOICE_TYPE_STRING "type_string"
#define INVOICE_BILLTO "bill-to"
-#define INVOICE_ENTRIES "list_of_entries"
#define INVOICE_JOB "invoice_job"
#define INVOICE_FROM_LOT "invoice-from-lot"
diff --git a/libgnucash/engine/qofclass.h b/libgnucash/engine/qofclass.h
index 54378068b7..f671df69a8 100644
--- a/libgnucash/engine/qofclass.h
+++ b/libgnucash/engine/qofclass.h
@@ -99,34 +99,6 @@ single reference between two known objects.
#define QOF_TYPE_KVP "kvp"
#define QOF_TYPE_CHAR "character"
#define QOF_TYPE_CHOICE "choice" /* was moved from (deleted) qofchoice.h */
-#define QOF_TYPE_COLLECT "collection" /**< secondary collections
-are used for one-to-many references between entities and are
-implemented using ::QofCollection.
-These are \b NOT the same as the main collections in the QofBook.
-
--# Each ::QofCollection contains one or many entities - *all* of a single type.
--# The entity type within the collection can be determined at run time.
--# Easy conversions to GList or whatever in the param_setfcn handler.
--# Each parameter can have its own collection.
--# Each entity can have a different *type* of collection to its siblings,
-provided that it is acceptable to the set function.
--# Each object decides which types are acceptable for which parameter in the
- set functions. This is then part of the API for that object.
-
- QOF_TYPE_COLLECT has two functions, both related to one-to-many
-links:
- - Represent a reference between 2 entities with a list of acceptable types.
- (one object linked to many types of single entities)
- - Represent a reference between one entity and many entities of another type.
- (one object linked to many entities of a single type.)
-
- If the set function can handle it, it could also be used for true one-to-many
-links: one object linked to many entities of many types.
-
- n.b. Always subject to each collection holding only one type at runtime.
- (otherwise use books).
-
- */
/** @} */
/** Type of Parameters (String, Date, Numeric, GncGUID, etc.) */
typedef const char * QofType;
diff --git a/libgnucash/engine/qofinstance.cpp b/libgnucash/engine/qofinstance.cpp
index 555a57d321..6c3a71e576 100644
--- a/libgnucash/engine/qofinstance.cpp
+++ b/libgnucash/engine/qofinstance.cpp
@@ -147,17 +147,6 @@ static void qof_instance_class_init(QofInstanceClass *klass)
GNC_TYPE_GUID,
G_PARAM_READWRITE));
- g_object_class_install_property
- (object_class,
- PROP_COLLECTION,
- g_param_spec_pointer ("collection",
- "Object Collection",
- "A collection of like objects of which this "
- "particular object is amember. E.g.. A "
- "collection of accounts, or a collection of "
- "splits.",
- G_PARAM_READWRITE));
-
g_object_class_install_property
(object_class,
PROP_BOOK,
diff --git a/libgnucash/engine/qofquery.cpp b/libgnucash/engine/qofquery.cpp
index 0ee62807f5..5b4ba9a033 100644
--- a/libgnucash/engine/qofquery.cpp
+++ b/libgnucash/engine/qofquery.cpp
@@ -1844,7 +1844,6 @@ qof_query_printValueForParam (QofQueryPredData *pd, GString * gs)
g_string_append_printf (gs, " boolean: %s", pdata->val ? "TRUE" : "FALSE");
return;
}
- /** \todo QOF_TYPE_COLLECT */
return;
} /* qof_query_printValueForParam */
diff --git a/libgnucash/engine/qofquerycore.cpp b/libgnucash/engine/qofquerycore.cpp
index 4d67271bcf..42acabdd60 100644
--- a/libgnucash/engine/qofquerycore.cpp
+++ b/libgnucash/engine/qofquerycore.cpp
@@ -82,9 +82,6 @@ static const char * query_boolean_type = QOF_TYPE_BOOLEAN;
typedef char (*query_char_getter) (gpointer, QofParam *);
static const char * query_char_type = QOF_TYPE_CHAR;
-typedef QofCollection * (*query_collect_getter) (gpointer, QofParam*);
-static const char * query_collect_type = QOF_TYPE_COLLECT;
-
typedef const GncGUID * (*query_choice_getter) (gpointer, QofParam *);
static const char * query_choice_type = QOF_TYPE_CHOICE;
@@ -1225,184 +1222,6 @@ char_to_string (gpointer object, QofParam *getter)
return g_strdup_printf ("%c", num);
}
-/* QOF_TYPE_COLLECT =============================================== */
-
-static int
-collect_match_predicate (gpointer object, QofParam *getter,
- QofQueryPredData *pd)
-{
- query_coll_t pdata;
- GList *node, *node2, *o_list;
- const GncGUID *guid;
-
- pdata = (query_coll_t)pd;
- VERIFY_PREDICATE (query_collect_type);
- guid = nullptr;
- switch (pdata->options)
- {
- case QOF_GUID_MATCH_ALL :
- {
- for (node = pdata->guids; node; node = node->next)
- {
- for (o_list = static_cast<GList*>(object); o_list;
- o_list = static_cast<GList*>(o_list->next))
- {
- guid = ((query_guid_getter)getter->param_getfcn)
- (o_list->data, getter);
- if (guid_equal (static_cast<GncGUID*>(node->data), guid))
- {
- break;
- }
- }
- if (o_list == nullptr)
- {
- break;
- }
- }
- break;
- }
- case QOF_GUID_MATCH_LIST_ANY :
- {
- o_list = ((query_glist_getter)getter->param_getfcn) (object, getter);
- for (node = o_list; node; node = node->next)
- {
- for (node2 = pdata->guids; node2; node2 = node2->next)
- {
- if (guid_equal (static_cast<GncGUID*>(node->data),
- static_cast<GncGUID*>(node2->data)))
- {
- break;
- }
- }
- if (node2 != nullptr)
- {
- break;
- }
- }
- g_list_free(o_list);
- break;
- }
- default :
- {
- guid = ((query_guid_getter)getter->param_getfcn) (object, getter);
- for (node = pdata->guids; node; node = node->next)
- {
- if (guid_equal (static_cast<GncGUID*>(node->data), guid))
- {
- break;
- }
- }
- }
- switch (pdata->options)
- {
- case QOF_GUID_MATCH_ANY :
- case QOF_GUID_MATCH_LIST_ANY :
- {
- return (node != nullptr);
- break;
- }
- case QOF_GUID_MATCH_NONE :
- case QOF_GUID_MATCH_ALL :
- {
- return (node == nullptr);
- break;
- }
- case QOF_GUID_MATCH_NULL :
- {
- return ((guid == nullptr) || guid_equal(guid, guid_null()));
- break;
- }
- default :
- {
- PWARN ("bad match type");
- return 0;
- }
- }
- }
- return 0;
-}
-
-static int
-collect_compare_func (gpointer a, gpointer b, gint options, QofParam *getter)
-{
- gint result;
- QofCollection *c1, *c2;
-
- c1 = ((query_collect_getter)getter->param_getfcn) (a, getter);
- c2 = ((query_collect_getter)getter->param_getfcn) (b, getter);
- result = qof_collection_compare(c1, c2);
- return result;
-}
-
-static void
-collect_free_pdata (QofQueryPredData *pd)
-{
- query_coll_t pdata;
- GList *node;
-
- node = nullptr;
- pdata = (query_coll_t) pd;
- VERIFY_PDATA (query_collect_type);
- for (node = pdata->guids; node; node = node->next)
- {
- guid_free (static_cast<GncGUID*>(node->data));
- }
- qof_collection_destroy(pdata->coll);
- g_list_free (pdata->guids);
- g_free (pdata);
-}
-
-static QofQueryPredData *
-collect_copy_predicate (const QofQueryPredData *pd)
-{
- const query_coll_t pdata = (const query_coll_t) pd;
-
- VERIFY_PDATA_R (query_collect_type);
- return qof_query_collect_predicate (pdata->options, pdata->coll);
-}
-
-static gboolean
-collect_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
-{
- const query_coll_t pd1 = (const query_coll_t) p1;
- const query_coll_t pd2 = (const query_coll_t) p2;
- gint result;
-
- result = qof_collection_compare(pd1->coll, pd2->coll);
- if (result == 0)
- {
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-query_collect_cb(QofInstance* ent, gpointer user_data)
-{
- query_coll_t pdata;
- GncGUID *guid;
-
- guid = (GncGUID*)qof_entity_get_guid(ent);
- pdata = (query_coll_t)user_data;
- pdata->guids = g_list_append(pdata->guids, guid);
-}
-
-QofQueryPredData *
-qof_query_collect_predicate (QofGuidMatch options, QofCollection *coll)
-{
- query_coll_t pdata;
-
- g_return_val_if_fail (coll, nullptr);
- pdata = g_new0 (query_coll_def, 1);
- pdata->pd.type_name = query_collect_type;
- pdata->options = options;
- qof_collection_foreach(coll, query_collect_cb, pdata);
- if (nullptr == pdata->guids)
- {
- return nullptr;
- }
- return ((QofQueryPredData*)pdata);
-}
/* QOF_TYPE_CHOICE */
@@ -1686,11 +1505,6 @@ static void init_tables (void)
char_copy_predicate, char_free_pdata, char_to_string,
char_predicate_equal
},
- {
- QOF_TYPE_COLLECT, collect_match_predicate, collect_compare_func,
- collect_copy_predicate, collect_free_pdata, nullptr,
- collect_predicate_equal
- },
{
QOF_TYPE_CHOICE, choice_match_predicate, nullptr,
choice_copy_predicate, choice_free_pdata, nullptr, choice_predicate_equal
diff --git a/libgnucash/engine/qofquerycore.h b/libgnucash/engine/qofquerycore.h
index a92b47b1bc..ad6d53e648 100644
--- a/libgnucash/engine/qofquerycore.h
+++ b/libgnucash/engine/qofquerycore.h
@@ -172,8 +172,6 @@ QofQueryPredData *qof_query_double_predicate (QofQueryCompare how, double val);
QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val);
QofQueryPredData *qof_query_char_predicate (QofCharMatch options,
const gchar *chars);
-QofQueryPredData *qof_query_collect_predicate (QofGuidMatch options,
- QofCollection *coll);
QofQueryPredData *qof_query_choice_predicate (QofGuidMatch options, GList *guids);
/** Copy a predicate. */
Summary of changes:
libgnucash/engine/gncInvoice.c | 57 ------------
libgnucash/engine/gncInvoice.h | 1 -
libgnucash/engine/qofclass.h | 28 ------
libgnucash/engine/qofinstance.cpp | 11 ---
libgnucash/engine/qofquery.cpp | 1 -
libgnucash/engine/qofquerycore.cpp | 186 -------------------------------------
libgnucash/engine/qofquerycore.h | 2 -
7 files changed, 286 deletions(-)
More information about the gnucash-changes
mailing list