Commit Graph

24723 Commits

Author SHA1 Message Date
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
John Ralls
99103ffd10 Change gnc-register-option functions to take GncOptionDB*.
Instead of std::unique_ptr<GncOptionDB> because there's no way
to get a unique_ptr through a C call.
2021-07-31 17:54:28 -07:00
John Ralls
8fe338f315 Temporarily disable building dialog-report-column-view.
It will require some major surgery to get working, and disabling
it allows building GnuCash so that the Book Properties dialog
can be runtime-tested.
2021-07-31 17:54:28 -07:00
John Ralls
9111f118e0 Business option create_option_widget specializations.
Required creating a registration class for create_option_widget
overload functions because without it the dispatch function
complained of missing symbols at link time.
2021-07-31 17:54:28 -07:00
John Ralls
01c0fe2364 Include what we use. 2021-07-31 17:54:28 -07:00
John Ralls
25b717d47a Add a rudimentary C API for GncOptionDB.
So that most of the gnome-util and gnome consumers don't need to
be converted to C++.

Hide the corresponding functions in options-utils to stop the
compiler whining.

Note that this commit breaks the build but is necessary at
least temporarily to compartmentalize the changes.
2021-07-31 17:54:28 -07:00
John Ralls
4451f58bd6 Rename RelativeDatePeriods missed earlier. 2021-07-31 17:54:28 -07:00
John Ralls
6feb92d4e8 Provide scheme function new-gnc-optiondb.
Wraps creating a GncOptionDBPtr, freeing up gnc_option_db_new() to
return a GncOptionDB* for use in C code. Convert gnc_option_db_new()
calls in gtest-gnc-optiondb to call std::make_unique() as well.
2021-07-31 17:54:28 -07:00
John Ralls
f9e136dbac Get the spelling of GncMultichoiceOptionEntry consistent. 2021-07-31 17:54:28 -07:00
John Ralls
eb6e31f803 dialog-options: Change signature of gnc_option_get_gtk_widget()
So that it can be called from C.
2021-07-31 17:54:28 -07:00