@@ -446,54 +446,39 @@ gnc_lot_get_title (const GNCLot *lot)
446446{
447447 if (!lot) return nullptr ;
448448
449- GValue v = G_VALUE_INIT;
450- qof_instance_get_kvp (QOF_INSTANCE (lot), &v, 1 , " title" );
451- const char *rv = G_VALUE_HOLDS_STRING (&v) ? g_value_get_string (&v) : nullptr ;
452- g_value_unset (&v);
453-
454- return rv;
449+ auto str{qof_instance_get_path_kvp<const char *> (QOF_INSTANCE (lot), {" title" })};
450+ return str ? *str : nullptr ;
455451}
456452
457453const char *
458454gnc_lot_get_notes (const GNCLot *lot)
459455{
460456 if (!lot) return nullptr ;
461457
462- GValue v = G_VALUE_INIT;
463- qof_instance_get_kvp (QOF_INSTANCE (lot), &v, 1 , " notes" );
464- const char *rv = G_VALUE_HOLDS_STRING (&v) ? g_value_get_string (&v) : nullptr ;
465- g_value_unset (&v);
466- return rv;
458+ auto str{qof_instance_get_path_kvp<const char *> (QOF_INSTANCE (lot), {" notes" })};
459+ return str ? *str : nullptr ;
467460}
468461
469462void
470463gnc_lot_set_title (GNCLot *lot, const char *str)
471464{
472- GValue v = G_VALUE_INIT;
473465 if (!lot) return ;
474466
475467 qof_begin_edit (QOF_INSTANCE (lot));
476- g_value_init (&v, G_TYPE_STRING);
477- g_value_set_static_string (&v, str);
478- qof_instance_set_kvp (QOF_INSTANCE (lot), &v, 1 , " title" );
468+ qof_instance_set_path_kvp<const char *> (QOF_INSTANCE (lot), g_strdup (str), {" title" });
479469 qof_instance_set_dirty (QOF_INSTANCE (lot));
480470 gnc_lot_commit_edit (lot);
481- g_value_unset (&v);
482471}
483472
484473void
485474gnc_lot_set_notes (GNCLot *lot, const char *str)
486475{
487- GValue v = G_VALUE_INIT;
488476 if (!lot) return ;
489477
490478 qof_begin_edit (QOF_INSTANCE (lot));
491- g_value_init (&v, G_TYPE_STRING);
492- g_value_set_static_string (&v, str);
493- qof_instance_set_kvp (QOF_INSTANCE (lot), &v, 1 , " notes" );
479+ qof_instance_set_path_kvp<const char *> (QOF_INSTANCE (lot), g_strdup (str), {" notes" });
494480 qof_instance_set_dirty (QOF_INSTANCE (lot));
495481 gnc_lot_commit_edit (lot);
496- g_value_unset (&v);
497482}
498483
499484/* ============================================================= */
0 commit comments