Commit Graph

24732 Commits

Author SHA1 Message Date
John Ralls
55a2ed1df8 gnc-optiondb.i uses functions declared in gnc-optiondb.h.
So it needs it declared in the swig file.
2021-07-31 17:54:29 -07:00
John Ralls
18b83874fd Another bit of Remove test-option-utils 2021-07-31 17:54:29 -07:00
John Ralls
0b7ccfbd5b Create gnc-make-foo-option functions.
For compatibility with current Scheme code.
2021-07-31 17:54:29 -07:00
John Ralls
a602f64b17 SFINAE-constrain the GncOption constructor templates.
So that one can't instantiate an invalid constructor.

Unfortunately Swig doesn't understand SFINAE and will try to create the
invalid constructors anyway but at least this generates a compile-time
error when it tries to.
2021-07-31 17:54:29 -07:00
John Ralls
43f4bcb610 Make GncOptionUIType an enum class.
So that Swig will create properly constrained identifiers for its values.
2021-07-31 17:54:29 -07:00
John Ralls
7fa6778b4b Add a register_option overload to GncOptionDB
For compatibility with existing scheme code.
2021-07-31 17:54:29 -07:00
John Ralls
cb7270cafe Fix myriad gcc10 complaints. 2021-07-31 17:54:29 -07:00
John Ralls
76b0001cbe Remove option-util. 2021-07-31 17:54:29 -07:00
John Ralls
e2c87f23c3 Convert optiondb users in gnome and gnome-utils to C++.
To enable using std::unique_ptr<GncObjectDB> and avoid memory management
problems.
2021-07-31 17:54:29 -07:00
John Ralls
ea835b31b7 Provide GncOptionPtr& overloads for register-option functions.
Simplifies and makes safer calls from Scheme and C++ by not requiring
a raw pointer.
2021-07-31 17:54:29 -07:00
John Ralls
472814d315 Change the normal internal option ValueType to SCM.
Internal options are used as a Scheme hack and don't need to be interpreted
on the C side so there's no point in converting them to C types.
2021-07-31 17:54:29 -07:00
John Ralls
023db23353 Make URLType an alias for const char* instead of char*.
Because it uses macros declared as string constants as values and C++
objects if one tries to initialize a non-const char* with a string constant.
On the other hand one doesn't want to strdup into a const char* because
then you can't free it, so all of the instances where it's strduped for
inserting into a container must be changed from URLType to char*.
2021-07-31 17:54:29 -07:00
John Ralls
ae73b3855d Cast const char* args from guile to char*.
Swig's guile typemaps lack a const char* freearg typemap. When a function
argument is explicitly const char* Swig automatically discards the const
in the temporary's decl so freeing it isn't a problem, but if the function
arg is declared as something typedeffed to const char* the alias is used
in the temporary's decl causing an error about discarding the const
qualifier when it's time to free the temporary. Providing a const char*
freearg typemap works around the shortcoming.
2021-07-31 17:54:29 -07:00
John Ralls
e48416010d Remove redundant GncOptionDB decl. 2021-07-31 17:54:29 -07:00
John Ralls
7022f5222d Revert gnc_option_db_lookup|set_glist_value to ...scm_value.
GLists and SCM lists are not interchangeable.
2021-07-31 17:54:29 -07:00
John Ralls
776d1aaa0e GNC_DEFINE_TYPE_WITH_CODE: Don't use class as a symbol name.
It conflicts with the C++ keyword. Even GObject code knows better.
2021-07-31 17:54:29 -07:00
John Ralls
8c77ce967b Implement and test obsolete option name aliasing. 2021-07-31 17:54:29 -07:00
John Ralls
90b8fce59f Fix build after merge. 2021-07-31 17:54:29 -07:00
John Ralls
60c1d16e64 Add/rename files in POTFILES. 2021-07-31 17:54:29 -07:00
John Ralls
4f3fd665cf Fix counter and counter_format storage in KVP.
So that they go to their own slots instead of to the options slot.
2021-07-31 17:54:29 -07:00
John Ralls
b19f3d383c Protect some exceptions from being passed to Swig. 2021-07-31 17:54:29 -07:00
John Ralls
52600bbd1f Instantiate gnc_register_number_range_option templates in SWIG. 2021-07-31 17:54:28 -07:00
John Ralls
31a0153fec Another GncOptionDBPtr fix. 2021-07-31 17:54:28 -07:00
John Ralls
85db341afe Remove test-option-utils
It no longer works. Since that's all that test-app-utils called,
delete it too.
2021-07-31 17:54:28 -07:00
John Ralls
21398dfda1 Testing fixups for using GncOptionDB* in register_option functions. 2021-07-31 17:54:28 -07:00
John Ralls
7dab089d49 Fix miscalculation of prev_quarter_end for the first quarter.
If the current quarter ends June 30 backing up 3 months from there
gets March 30, one day off. Back up first and calculate the end
of the actual quarter of interest.

Changed pre_quarter_start for consistency, it doesn't matter.
2021-07-31 17:54:28 -07:00
John Ralls
d1cfd62f31 Fix loading text fields from KVP into options. 2021-07-31 17:54:28 -07:00
John Ralls
1f0bfe0cfa Log an error if we try to create an option for an unregistered UI type. 2021-07-31 17:54:28 -07:00
John Ralls
c6fce31795 Set the component_class on the GNCOptionWin, silencing component-manager error. 2021-07-31 17:54:28 -07:00
John Ralls
507f35cc30 Fix wrong callback for TEXT control. 2021-07-31 17:54:28 -07:00
John Ralls
8440b9c99c Test QofInstance from option before trying to use it.
Avoids GObject type error noise.
2021-07-31 17:54:28 -07:00
John Ralls
2ccfe0c191 Finish implementing the TaxTable option GUI. 2021-07-31 17:54:28 -07:00
John Ralls
276d33975a Remove dialog-options.c, replaced by dialog-options.cpp.
Adds new function reset_default_value to GncOption; doing it outside
of the class requires knowing the Type of m_value.
2021-07-31 17:54:28 -07:00
John Ralls
5f9c66aa61 Save all options to KVP if clear_options is true. 2021-07-31 17:54:28 -07:00
John Ralls
6491c98563 Clean up some omitted type-forcing in set_option_from_ui_type() instances. 2021-07-31 17:54:28 -07:00
John Ralls
245a8fccc7 Correctly select UI types for GUID output. 2021-07-31 17:54:28 -07:00
John Ralls
c751e56184 Fix fail to load or save number-range values in KVP. 2021-07-31 17:54:28 -07:00
John Ralls
010ab1a965 Fix free of unallocated ptr crash. 2021-07-31 17:54:28 -07:00
John Ralls
79fdb4124e Fix some errant UI Types and a mis-formatted function. 2021-07-31 17:54:28 -07:00
John Ralls
e3b5a7d833 Fix boolean controls so that the set visitor recognizes the value. 2021-07-31 17:54:28 -07:00
John Ralls
2dd8d782e5 Don't crash if the option set doesn't set a default section. 2021-07-31 17:54:28 -07:00
John Ralls
7cb27b2636 Make changes to controls enable the Apply & OK buttons. 2021-07-31 17:54:28 -07:00
John Ralls
4a4e5d36f8 Enable gnc_register_owner_option to handle the three types that GncOwner aliases. 2021-07-31 17:54:28 -07:00
John Ralls
d8f83d6ee6 Boolean simple won't work if its UI type is INTERNAL. 2021-07-31 17:54:28 -07:00
John Ralls
3514725a97 Make gnc_register_number_range_option a template on ValueType.
GtkSpinButton works with doubles, but we want to preserve the
ability to use other types.
It really should have enable_if<is_arithmetic(ValueType)>.
2021-07-31 17:54:28 -07:00
John Ralls
e78c012699 Fill in the book options. 2021-07-31 17:54:28 -07:00
John Ralls
ae79fd016d More skeletons 2021-07-31 17:54:28 -07:00
John Ralls
28438e3126 Rewire gnome and gnome-utils to use GncOptionDB. 2021-07-31 17:54:28 -07:00
John Ralls
41e59df71f Remove unused and un-needed function. 2021-07-31 17:54:28 -07:00
John Ralls
1eef796f09 Add some skeleton functions to make the option-using code in gnucash/gnome-utils and gnucash/gnome happy. 2021-07-31 17:54:28 -07:00