Unstable Imap Editor

Geert Janssens geert.gnucash at kobaltwit.be
Wed Mar 28 07:45:53 EDT 2018

Op woensdag 28 maart 2018 12:09:33 CEST schreef Robert Fewell:
> Could some one explain the following, trying to fix the 2nd problem as I
> thought was the simpler one...
> If I try this ...
>     std::vector<std::string> path {IMAP_FRAME};
>     if (category)
>         path.emplace_back (category);
>     if (qof_instance_has_path_slot (QOF_INSTANCE (acc), path))
> I have a slot but the following does not...
>     category_head = g_strdup_printf (IMAP_FRAME "/%s", category);
>     if (qof_instance_has_slot (QOF_INSTANCE(acc), category_head))
> These two functions look like this...
> bool qof_instance_has_path_slot (QofInstance const * inst,
> std::vector<std::string> const & path)
> {
>     return inst->kvp_data->get_slot (path) != nullptr;
> }
> gboolean
> qof_instance_has_slot (const QofInstance *inst, const char *path)
> {
>     return inst->kvp_data->get_slot({path}) != NULL;
> }
> Does category_head need to be in a different format ?

get_slot expects a vector of path components.

In your first example that is what you pass. That path vector has two 
elements: IMAP_FRAME and category.

In the second example you pass a concatenated string that is used to 
initialize a path vector with one element. That is not what get_slot is 
expecting. It will search its internal model for this string as a key, but 
that doesn't exist. Only category exists as key. Using the vector 
specification it does work.

The primary change here is that internally gnucash is not interpreting the "/" 
as a path separator any more.


More information about the gnucash-devel mailing list