From cee3cdaff9a29a3f64e4d38faad6f96dc5873be4 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 12 Oct 2019 18:16:05 -0700 Subject: [PATCH] Instantiate GncOption::set_option for guile, initial types string and int. For proof-of-concept. Guile obviously doesn't know about templates. --- libgnucash/app-utils/gnc-optiondb.i | 6 +++++- libgnucash/app-utils/test/test-gnc-optiondb.scm | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libgnucash/app-utils/gnc-optiondb.i b/libgnucash/app-utils/gnc-optiondb.i index ade5c73e29..3ecee41f14 100644 --- a/libgnucash/app-utils/gnc-optiondb.i +++ b/libgnucash/app-utils/gnc-optiondb.i @@ -51,5 +51,9 @@ extern "C" SCM scm_init_sw_gnc_optiondb_module(void); %ignore GncOption; wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); - %include "gnc-optiondb.hpp" + +%extend GncOptionDB { + %template(set_option_string) set_option; + %template(set_option_int) set_option; + }; diff --git a/libgnucash/app-utils/test/test-gnc-optiondb.scm b/libgnucash/app-utils/test/test-gnc-optiondb.scm index f46b4303e4..cce651fb00 100644 --- a/libgnucash/app-utils/test/test-gnc-optiondb.scm +++ b/libgnucash/app-utils/test/test-gnc-optiondb.scm @@ -40,6 +40,10 @@ (let* ((option-db (gnc-option-db-new)) (string-opt (gnc-register-string-option option-db "foo" "bar" "baz" "Phony Option" "waldo"))) - (test-equal (GncOptionDB-lookup-option (GncOptionDBPtr-get option-db) "foo" "bar") "waldo")) + (test-equal "waldo" (GncOptionDB-lookup-option + (GncOptionDBPtr-get option-db) "foo" "bar")) + (GncOptionDB-set-option-string (GncOptionDBPtr-get option-db) "foo" "bar" "pepper") + (test-equal "pepper" (GncOptionDB-lookup-option + (GncOptionDBPtr-get option-db) "foo" "bar"))) (test-end "test-gnc-make-string-option"))