mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[account.cpp] refactor gnc_account_get_map_entry
Have comprehensive tests in a5d101d1b
This commit is contained in:
@@ -6021,23 +6021,10 @@ gnc_account_imap_get_info (Account *acc, const char *category)
|
||||
gchar *
|
||||
gnc_account_get_map_entry (Account *acc, const char *head, const char *category)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
gchar *text = NULL;
|
||||
std::vector<std::string> path {head};
|
||||
if (category)
|
||||
path.emplace_back (category);
|
||||
if (qof_instance_has_path_slot (QOF_INSTANCE (acc), path))
|
||||
{
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (acc), &v, path);
|
||||
if (G_VALUE_HOLDS_STRING (&v))
|
||||
{
|
||||
gchar const *string;
|
||||
string = g_value_get_string (&v);
|
||||
text = g_strdup (string);
|
||||
}
|
||||
}
|
||||
g_value_unset (&v);
|
||||
return text;
|
||||
return get_kvp_string_path (acc, {head, category});
|
||||
else
|
||||
return get_kvp_string_path (acc, {head});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user