Commit Graph

83 Commits

Author SHA1 Message Date
Geert Janssens
fce75ea748 Add dedicated api to query build-time, version related compile constants
And use it in several location in the code for consistent behaviour
2019-02-21 17:00:15 +01:00
John Ralls
140eb0b110 Log a warning in gnc_get_locale() instead of writing to stderr. 2019-02-12 12:58:42 -08:00
John Ralls
7d7da8e2c4 Bug 797067 - Date displayed incorrectly in register take two.
Revert using boost::locale to generate std::locales as boost::locale-
generated locales don't implement std::locale::facet and there was
a bug in the boost::locale ICU wrapper code that caused the wrong year
to be output for the last 3 days of December.

GCC's libstdc++ supports only the "C" locale on Windows and throws if
one attempts to create any other kind. For dates we work around this
by using wstrftime() to format according to locale and then convert
the UTF16 string to UTF8. wstrftime() interprets the time zone flags
%z, %Z, and %ZP differently so we process those first before calling
strftime. This will have the unfortunate effect of not localizing
timezone names but it's as close as we can get.
2019-02-08 11:56:32 -08:00
John Ralls
b4fedff90e Provide a single static instance of C++ locale.
We can't use std::locale::global because all streams imbue it by
default and if it's not 'C' (aka std::locale::classic) then we
must imbue all the streams that we don't want localized, and that's
most of them.

Provides error checking for setting the C++ locale from the environment.
This is necessary both because the environment might have an invalid
locale, which would cause an unhandled exception crash.

On windows std::locale("") can't handle some Microsoft-style locale
strings (e.g. Spanish_Spain) so we use boost::locale's gen("") function
to set the locale--though even that can't handle a Microsoft-style
locale string with an appended charset (e.g. Spanish_Spain.1252) and
that's what glibc's setlocale(LC_ALL, NULL) emits.
2019-01-06 10:13:01 -08:00
Christian Stimming
1eed3db5e7 Some (very minor) translation string improvements.
Fix superfluous space.
Unify case sensitivity in string that appears multiple times.
2018-12-30 22:23:04 +01:00
Geert Janssens
267852ba76 Add a note on cvt and imbuing locales in a boost::filesystem::path object 2018-12-28 18:47:06 +01:00
Geert Janssens
272ca421b7 Set up filepath utils to determine the GNC_CONFIG_HOME in the same way as GNC_DATA_HOME
Until now GNC_CONFIG_HOME was more or less hard-coded.
Now it can be set via environment variable GNC_CONFIG_HOME.
In addition it will automatically be created to avoid potential
user confusion.
2018-12-28 18:36:52 +01:00
Geert Janssens
ac2e0946ea Rewrite path scrubbing in a c++ way 2018-12-28 16:15:00 +01:00
John Ralls
faba7975ac Fix a bunch of memory allocation errors found by clang static analysis. 2018-11-30 15:08:41 +09:00
John Ralls
26714d2e17 Bug 792446 - Mixed languages in error dialog. 2018-09-27 18:05:42 -07:00
Geert Janssens
2094282790 Merge branch 'block-pref' of https://github.com/Bob-IT/gnucash into maint 2018-09-27 21:57:39 +02:00
Robert Fewell
b6f2b111bc Block registered prefs when preference dialogue loaded
When the preference dialogue is loaded and options are set, the ones
with registered callbacks fire causing parts of Gnucash to be updated.
This was observed with gnc_split_register_load being executed 5 times
for each open register when the preference dialogue was loaded.

To overcome this, a couple of functions have been created to block and
unblock all registered prefs and used while the preference dialogue is
loaded.
2018-09-27 15:57:34 +01:00
John Ralls
2d565215cd Fix localedir relocation.
Since LOCALEDIR is now always absolute we need to see if there's a
prefix and if LOCALEDIR is a subdir of PREFIX instead.
2018-09-18 16:08:48 -07:00
John Ralls
83b1b8adfc Fix typos. 2018-09-16 13:05:49 -07:00
John Ralls
162605f505 Fix Windows binreloc executable finding.
Taking into account the behavior of
g_win32_get_package_installation_directory_of_module when the last
directory element either is or isn't "bin".
2018-09-16 12:36:04 -07:00
John Ralls
10a21cbfac Merge branch 'Bug794526' into maint 2018-09-11 10:46:02 -07:00
John Ralls
f219bc45aa Bug 794526 - Python bindings can't find loadable modules.
Always use absolute paths for configured directories (BINDIR etc.)
Abstract out the guts of gnc_gbr_find_foo_dir for foo in lib, bin, and data.
etc requires special handling because of the way it's treated if prefix
begins with /opt.

Always fall back on the configured directory if binreloc is disabled and
no default is passed in.
2018-09-09 16:36:39 -07:00
Geert Janssens
4cc61463ab Remove unused variable 2018-09-09 22:50:05 +02:00
Geert Janssens
69fef8277f Revert "Add preference to control toolbar appearance"
This reverts commit 3b09313107.
2018-07-31 17:30:07 +02:00
Robert Fewell
3b09313107 Add preference to control toolbar appearance
Add preferences to select icon size and item layout on the toolbar.
Fixes Bug 796739 - Toolbar buttons have no labels, part 1 of 3.
2018-07-15 10:40:41 -07:00
Geert Janssens
1f3cf845c4 Work around a conflict between gcc 8.0 and swig 3.0
The swig 3.0 generated python wrappers trigger a warning converted into an error issued
by gcc 8.0 for using strncpy as follows:
strncpy(buff, "swig_ptr: ", 10);
The reason is this call will truncate the trailing null byte from the string.
This appears to have been fixed in swig master already but that's not released yet
so let disable the warning when compiling the swig wrappers until it is.
2018-05-09 22:18:29 +02:00
Geert Janssens
a9f35ed7ae Lowercase cmake commands
A huge bikeshed fest but it distracted me enough to do it anyway.
2018-05-03 23:18:15 +02:00
Geert Janssens
0c6b92959a Get metadata migration working again when upgrading from 2.6 to 3.1
Due to a typo the old GNC_DOT_DIR path was wrong
($HOME.gnucash instead of $HOME/.gnucash)
2018-04-30 20:59:25 +02:00
John Ralls
c443160737 Fix Travis failures from transcoding fixes. 2018-04-23 14:02:24 -07:00
John Ralls
14c30344c2 Work around libstdc++ weirdness with codecvt destructor. 2018-04-22 16:51:01 -07:00
John Ralls
35cd165bec Bug 795134 - Improper handle of unicode character in username
Part 1: gnc-filename-utils didn't manage the encoding differences
between Windows (UTF16) and GLib (UTF-8).
2018-04-22 13:55:36 -07:00
John Ralls
cad6bb4272 Bug 792105 - Startup takes several minutes, take two.
First, remove the unnecessary locale push & pop on <CT_TIME64>load.

Second, the registry accesses were caused by using g_win32_get_locale
to convert the Microsoft locale strings to POSIX ones. We don't care
what kind of string we get as long as we can pass it back to setlocale,
so remove that.

Third, gnc_push/pop_locale were used only in backend/dbi in a
very limited way and did much more than was necessary, so
convert them to C++ inlines in gnc-backend-dbi.hpp that does
only what we need them to.
2018-04-17 16:32:45 -07:00
Geert Janssens
87f94abc8d Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt' 2018-04-16 23:25:37 +02:00
John Ralls
f680823dbf Bug 795039 - Crash on startup using Technicolor Style sheet in report
The mingw-w64 toolchain bizarrely substitutes scm_to_locale_string()
for scm_to_utf8_string(). This results in latin1 (yeah, "locale" is
a lie) instead of utf8 which causes an assertion in
g_utf8_collate_key().

Perhaps equally bizarre, the compiler doesn't make the substitution
with scm_to_utf8_stringn(), so use that instead.
2018-04-14 10:18:01 -07:00
John Ralls
192a3c3d2b Set GNC_VCS at build time instead of when making the tarball.
Because the tarball is always made from a VCS repo.
2018-04-09 15:10:25 -07:00
John Ralls
dc6d86efdb Convert to a two-digit version number. 2018-03-31 18:00:15 -07:00
John Ralls
4ecd9c2dd4 Fix the Python Console for Python3.
Replacing libgncmod-python, libgncmod-core-utils-python, and
libgncmod-app-utils-python with _sw_core_utils and _sw_app_utils.
The latter two are the modules that init.py wants to load and with
Python3 Swig appears to no longer make them available via libgncmod.

Note that there may still be some problems with actually using the
console, but it at least loads at startup without complaint.
2018-03-18 11:59:13 -07:00
Geert Janssens
ad1664604f Cleanup namespace usage for boost::locale
In a previous commit I wrongly believed xgettext might not find
our strings if we used the fully namespaced boost::locale::translate or
aliased bl::translate instead of just translate. However that's
wrong, so I have changed the code to always use bl::translate.
2018-02-28 16:50:20 +01:00
Geert Janssens
c29b9c9cbf Remove autotools-only path exception to find reports
With it we can also remove the hack to find standard reports while running
from the build tree.
2018-02-28 12:08:37 +01:00
Geert Janssens
72a48c0884 Improve config and app data migration to handle renaming of config<version>.user to config-user.scm on all platforms 2018-02-26 18:58:22 +01:00
Geert Janssens
10ab87d95c Make travis happy
On older stdlibc++ the default constructor of a stringstream is deleted.
2018-02-24 21:36:39 +01:00
Geert Janssens
61a21d12c6 Look for user editable config files in gnc_userconfig_dir instead of gnc_userdata_dir
At present these are
- log.conf
- config-user.scm (previously config.user-2.0)

Implement one-time migration of these files to the proper directory if they previously exist
Look for a log.conf file in gnc_userconfig_dir instead of gnc_userdata_dir

Note this commit also uses boost::locale::translate for the first time.
We may need to fine-tune our use, but in the current state strings marked
for translation using that function are already picked up for gnucash.pot.
2018-02-24 20:39:26 +01:00
Geert Janssens
50e2a3def7 Use a platform dependent package name for gnc_user[config|data]_dir
Windows and OS X expect the directory name to be capitalized while linux typically uses an all-lowercase name.
2018-02-19 22:53:32 +01:00
Geert Janssens
62fd179f87 Adjust gnc_userconfig_dir and get_userconfig_home to the former returns a subdirectory of the latter
Also add a few comments to make the distinction more clear.
2018-02-19 20:31:51 +01:00
Robert Fewell
7c9ac17cb6 Move the user CSS settings file
Move the CSS settings file to a location based on XDG_CONFIG_HOME which
is OS dependant but with slight changes for Windows and OS X.

- Windows: CSIDL_APPDATA/Gnucash
- OS X: $HOME/Application Support/Gnucash
- Linux: $XDG_CONFIG_HOME/gnucash (or the default $HOME/.config/gnucash)
2018-02-18 22:40:45 +00:00
John Ralls
04408650c1 Fix double free, caused test to crash on Mac. 2018-02-15 11:04:15 -08:00
Geert Janssens
59fb8efaf9 Merge branch 'maint' into unstable 2018-02-02 18:57:24 +01:00
Geert Janssens
0d4f6e054d Improve gnc_data_home verification and creation
- Don't attempt to create a subdirectory of a non-existing home directory (use tmpdir as base directory in that case)
- Make sure all tests run in an environment with GNC_BUILDDIR and GNC_UNINSTALLED set. Otherwise
  the one-shot old .gnucash to new GNC_DATA_HOME migration may already have run at build time,
  preventing us from informing the user a run time.
- Re-enable the userdata-dir with invalid home test (linux only).
2018-02-02 10:24:04 +01:00
Geert Janssens
0f5bb35166 Disable the proper test... 2018-02-01 22:31:27 +01:00
Geert Janssens
90517b69ce Temporarily disable test that breaks on travis only
It needs some more tweaking to cope with the false
assumption the builder can't create a temporary directory on /
2018-02-01 20:43:49 +01:00
Geert Janssens
2f16b092f5 Simplify filepath init code
It will no longer attempt to use /home/janssege/.gnucash. That was
requiring lots of extra conditions.
It will also default to a base directory (gnc_data_home) in the
build dir if it detects the code is run during building or testing.
That again allows to simplify it as there's no need for temp dir
juggling in case the build environment doesn't have a writable home dir.
2018-02-01 19:17:17 +01:00
Geert Janssens
ff24970f5f Add GENERATE_SWIG_WRAPPERS option to control the generation of swig wrappers independently of whether we're building from git
The swig wrappers don't really depend on git (but rather on swig) and there can be
situations the builder wants to generate the wrappers also from a tar ball.
2018-01-31 16:16:59 +01:00
Geert Janssens
49a936c1fd Rewrite gnc_add_swig_guile_command to work in dist tarball as well
When building from git it will add targets to generate the swig files.
When building from tarball it will just point at the generated source
files from the tarball.
2018-01-29 19:46:44 +01:00
Geert Janssens
36cb167b68 Rewrite gnc_add_swig_python_command to work in dist tarball as well
When building from git it will add targets to generate the swig files.
When building from tarball it will just point at the generated source
files from the tarball.
2018-01-29 19:46:44 +01:00
Geert Janssens
4317d8a8f6 Improve handling of generated distributable files
- the two dist_add_... macros now both take a list of file names
as argument so more files can be added at once to the dist tarball.
- dist_add_generated now creates the right target by itself. There's
  no need to pass one any more
- make the swig generated *.py module files explicit output files
- change a couple of custom_targets into custom_commands. The only
  reason they were defined as targets was to ensure they got built
  before the dist tarball. This is now properly handled by the
  dist_add_... macros.
- correctly handle dependency on swig-runtime.h (using OBJECT_DEPENDS
  was not the way to do it according to that property's help page)
2018-01-29 19:46:44 +01:00