Commit Graph

152 Commits

Author SHA1 Message Date
John Ralls
091d4aff22 Bug 798657 - Import Summary language is wrong
Root cause is using boost::locale::translate because it ignores
the LANGUAGES environment variable and doesn't support different
values for LC_MESSAGES, LC_DATE, LC_MONETARY, and LC_NUMERIC.
That makes it impossible to configure a user environment that
presents translated strings in a different locale from the one
applied to formatting dates and numbers.

To correct this replace all use of boost::locale::translate
with GNU gettext.
2022-12-16 15:34:10 -08:00
luz paz
ba94730a23 Fix various typos
Found via `codespell`
2022-09-06 10:44:29 -04:00
Christopher Lam
ecd2cdf425 [gnc-glib-utils] gnc_g_list_stringjoin skips NULL data 2022-09-06 18:14:15 +08:00
Christopher Lam
263f007d5c [gnc-filepath-utils] new: gnc_list_all_paths 2022-07-10 23:44:13 +08:00
Christopher Lam
3dfdf60608 [gnc-glib-utils] Define and export gnc_list_length_cmp 2021-11-02 23:34:25 +08:00
Christopher Lam
73ad5b1265 [gnc-glib-utils] use g_stpcpy instead of gnc_strcat
g_stpcpy will use stpcpy wherever available.
2021-09-15 21:09:01 +08:00
John Ralls
1d8983191d Fix runaway sed error. 2021-09-14 16:24:28 -07:00
John Ralls
74d0630867 Bug 798237 - Logging during XML file loading degrades performance...
significantly

Modify the DEBUG and PINFO macros to return unless qof_log_check is
true. Replace almost all direct calls to g_debug and g_message with
DEBUG and PINFO respectively.

Track the highest logging level sent to qof_log_set_level to provide a
short-circuit return in qof_log_check. Remove setting GNC_MOD_TESTS to
QOF_LOG_DEBUG so that the short-circuit threshold isn't defeated by
always being DEBUG.

Net result: 33% improvement in xml load times.
2021-09-14 15:15:11 -07:00
Christopher Lam
e84549926b [gnc-glib-utils] gnc_g_list_stringjoin to join a GList of strings
It traverses the GList twice (once to calculate the length) but
allocates only once.

Includes snippet from
https://www.joelonsoftware.com/2001/12/11/back-to-basics/
2021-08-12 09:19:34 +08:00
Christopher Lam
23bd716451 g_free gnc-path's gchar* intermediate strings 2021-08-03 12:14:12 +08:00
Christopher Lam
292deb0a11 [binreloc.c] free strings
subdir, prefix are not consistently freed.
2021-05-29 07:55:26 +08:00
Frank H. Ellenberger
93e2829ee5 Merge PR #899 into maint 2021-03-02 01:17:26 +01:00
luz paz
16b4976381 Fix typos in libgnucash/
Found via `codespell -q 3 -L ans,ba,parm,parms,numer`
2021-03-02 01:15:32 +01:00
Christopher Lam
b2b8792110 prepend-and-reverse instead of O(N^2) append 2021-02-24 09:08:25 +08:00
John Ralls
7a7c26f87e Move glib and gtk includes out of extern C for tests.
Needed to compile with glib 2.67 and later.
2021-02-16 13:23:48 -08:00
Bill Nottingham
c0f2c3ae25 Fix build with glib2 2.67.x.
glib headers should not be included with 'extern "C"'.
2021-02-16 13:23:16 -08:00
John Ralls
7a8a0f40b1 Fix missing space in warning message. 2020-11-29 10:59:25 -08:00
Bill Nottingham
06110e2abd Fix warning about misleading indentation from recent gcc.
Patch by <law@redhat.com>
2020-10-15 08:38:00 +08:00
Gaming4JC
cca4524055
Fix warnings: missing sentinel in function calls
When compiling with -Werror, GNUCash fails to build due to various error: missing sentinel in function call.
This patch resolves the issue by passing nullptr instead of C-style casting NULL.
2020-09-06 00:50:54 -04:00
Geert Janssens
f749f136ce Drop unused boost::locale::generator instantiations
We now have one single case in gnc-locale-utils and all code
uses gnc_get_boost_locale to get the proper locale.
2020-06-09 23:10:43 +02:00
Geert Janssens
69a04be353 Fix translations using boost::locale::translate
This requires a std::locale generated from a boost::locale::generator
The examples already in our code base used the wrong message_path while
creating the generator and as a result our message catalogs weren't found.

As with the std::locale I have added code to create a locale via
boost::locale only once instead of having each c++ file redo the work.

This code expects a message_path to set for the boost generator.
An earlier attempt queried for this path directly from within
gnc-locale-utils using gnc_get_locale_dir (from gnc-path.h).

That however broke several c++ tests depending on gnc_locale_utils as those
then also needed to be linked against gnc-path.o. I couldn't get the linker
to do this properly so I worked around it for now by splitting the boost_locale
functionality in two steps:
- an initializer step that takes the messages_path as a string and will
  generate the locale
- a getter to get the locale.

The initializer should only be run once, and before the getter is called.
It won't hurt though if the initializer is called more often.
If the getter is called before the initializer it will still
generate a std::locale but without setting a messages_path. It will then
also log a warning explaining translations may not be properly found.
2020-06-09 22:58:06 +02:00
John Ralls
fde6be6e01 Fix binreloc compile error with gcc. 2020-05-25 08:01:47 -07:00
Mike Alexander
b1ffe2246a CLean up the binreloc code a bit. It is won't work pervectly, but it's better.
Make it do something plausible in a non0QUartz Mac build and make it handle
running GnuCash from a symlink.
2020-05-25 03:30:59 -04:00
John Ralls
3ca8fa1229 Merge branch 'maint' 2020-04-13 11:27:14 -07:00
John Ralls
06033c19cd Fix typo. Really fixes 797674. 2020-04-12 13:40:49 -07:00
John Ralls
c91fb77fae Bug 797674 - 3.9: test-gnc-path-util failed on Debian amd64 2020-04-11 14:23:27 -07:00
Geert Janssens
5c468b33bf Housekeeping - clarify the use of the word backend in a warning message
In this context backend refers to a preferences implementation.
To disambiguate this from our qof backends, add the word 'preferences'
2020-02-28 20:46:16 +01:00
Geert Janssens
ab5b7155af CMake - remove parameter repetition in else() and endif() statements
Fix leftovers after the maint branch merge
2020-02-06 17:01:26 +01:00
Geert Janssens
301db9020d Merge branch 'maint' 2020-02-06 16:50:08 +01:00
Geert Janssens
e79e82edcf CMake - remove parameter repetition in else() and endif() statements
This follows Professional CMake's recommended practises
2020-02-05 11:38:14 +01:00
Christopher Lam
62c2203d40 Merge branch 'maint' 2020-01-30 20:30:04 +08:00
Geert Janssens
4537c1de36 Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt'
Update on this bug. Before doing the binreloc dance on various
paths check if the calculated dynamic prefix is still the same
as the compile time PREFIX. If so, just stick with the compile
time path names as this means the application wasn't relocated
anyway. Only if the dynamic prefix is different, try to
recalculate the requested paths relative to the dynamic
prefix.
Together with the configure time fix to detect /etc/opt is
outside of the /opt prefix, this eliminates the need for further
special case handling of the sysconfig directory so that
special case handling is removed.
2020-01-22 22:40:11 +01:00
Geert Janssens
490b20d2da Merge branch 'maint' 2020-01-17 18:35:30 +01:00
Geert Janssens
d8a304c2c9 Housekeeping - reduce the number of PACKAGE and VERSION related cmake variables
This starts by setting the gnucash version number in the 'project' call.
This will result in a number of variables set by cmake. The remainder
of this commit is to reuse the auto-generated
PROJECT_NAME, PROJECT_VERSION, PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK
instead of all the various instances of PACKAGE, GNUCASH_MAJOR_VERSION
and so on.

One parameter is worth mentioning - GETTEXT_PACKAGE
GnuCash is not using this directly (any more) but it has to be set before
including gi18n-lib.h.
2020-01-17 18:15:27 +01:00
Christopher Lam
3db699786f [core-utils.i] declare prefs as ENUMs 2020-01-15 18:04:35 +08:00
Geert Janssens
08d685f4aa Define SET_ENUM in core-utils.i as well
Will be used to expose our settings related constants to guile
2020-01-15 09:29:27 +01:00
Geert Janssens
a1898daf6c core-utils - move python wrapper code to bindings/python
This makes libgnucash/core-utils completely guile and python free.
2019-12-06 19:59:11 +01:00
Geert Janssens
ad8c388235 core-utils - rework link_libraries and include_directories propagation
By properly marking certain parameters as private or public
we can have cmake work out most of the link_libraries and
include_directoris for other targets dependent on core-utils
2019-12-06 19:59:11 +01:00
Geert Janssens
36c19b4085 core-utils - regroup build rules per target
- first all rules and variables for libgnc-core-utils
- then the rules to generate additional files (like
  gncla-dir.h or gnc-vcs-info.h)
- next rules for the python bindings
- finally rules for the dist targets

Note this commit also eliminates variable
core_utils_ALL_SOURCES, replacing its two
uses directly with its value.
2019-12-06 19:59:11 +01:00
Geert Janssens
94fc5233ea core-utils - cleanup build rules for target library gnc-core-utils
* Eliminate redundant variables (core_utils_ALL_INCLUDES, core_utils_ALL_LIBRARIES)
  Their values are used directly in target_include_directories and
  target_link_libraries respectively.
  They have been eliminated from the python target because target_include_directories
  and target_link_libraries will correctly propagate these values.
* Use generator expressions for a few conditional compile defines and options
2019-12-06 19:59:11 +01:00
Geert Janssens
28fa4c6465 core-utils - move wrapper code to bindings/guile
Note core-utils.i is used by both the guile and the python bindings so
it is moved up to the common bindings directory, while guile
specific changes are in bindings/guile.
2019-12-06 19:59:11 +01:00
Geert Janssens
18093b5e82 core-utils - move guile utils to bindings/guile 2019-12-06 19:59:11 +01:00
Geert Janssens
33e1ff645c Allow to pass include directories to the add_swig_xyz commands
This will be needed when the wrappers no longer live in
the same directory as the objects they are wrapping.
2019-12-06 19:59:11 +01:00
Geert Janssens
c59515f7b7 Revert unintended copy-paste error 2019-10-02 12:35:25 +02:00
Geert Janssens
0eb0b922d7 Python - remove 2.x only code paths 2019-10-02 12:35:25 +02:00
John Ralls
b8b33b9591 Revert "More conversions from pkg-config variables to imported targets."
This reverts commit 1a9fcfefad because
on MinGW cmake complains about the paths in pkgconfig files. This can
be addressed by using the MSYS2 cmake instead of the MINGW32 one, but
that requires some other changes... and there's also a path separator
bug in that version of FindPkgConfig.cmake.
2019-09-21 15:53:25 -07:00
John Ralls
6753b30b86 Convert GtkMacIntegration to package-style dependencies. 2019-09-15 12:27:43 -07:00
John Ralls
1a9fcfefad More conversions from pkg-config variables to imported targets.
Also converts ICU detection from pkgconfig to FindICU.
2019-09-13 17:05:35 -07:00
Christian Gruber
b303fc6d99 Use target gtest instead of GTEST_LIB and GTEST_INCLUDE_DIR
This simplifies usage of GoogleTest, since independent handling of
GTEST_LIB and GTEST_INCLUDE_DIR is not necessary anymore.

Additionally CMake creates a dependency now between target gtest and all
test applications using it. This improves build process when building
GoogleTest from source code. When any test application is built,
GoogleTest library is automatically rebuilt if necessary now for
instance.
2019-09-03 23:45:09 +02:00
Geert Janssens
9a48122d41 Merge maint 2019-08-27 17:25:41 +02:00