Commit graph

1084 commits

Author SHA1 Message Date
Dirk Hohndel
4b9a59a154 Merge branch 'gettext'
Bring all the localization changes into master in preparation for
Subsurface 2.1
2012-10-15 09:37:09 -07:00
Henrik Brautaset Aronsen
ef039c9d32 Support for gettext in MacOSX application bundle
The MacOSX applications bundle needs to be told where to bind the
text domain from.

Also copy the gettext .mo files in the install-macosx target.

[Dirk Hohndel: minor change in main(): move the path declaration to
               the beginning of the function]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 09:36:30 -07:00
jnoel
5c432d3c8a Update po/fr_FR.po
Just a few spelling corrections for fr_FR translation file

Signed-off-by: Jean-Noël Rouchon <jnoel@sissiou.net>
2012-10-15 09:34:37 -07:00
Dirk Hohndel
f1569a206e Improve translations
- fix two missing strings in equipment.c (thanks to Tommi Saviranta for
  pointing this out)

- add context for the translations of the Yearly/monthly statistics. The code
  for this ended up being incredibly ugly, but the gettext infrastructure
  really clashed with the way this is implemented. What I have now at least
  works (tested with the German translation)

- merge the new strings into all the po files. The non-German translations need
  to be updated. Make sure you remove the "# , fuzzy" lines or the current
  Makefile will ignore those additions.

- some minor cleanup of the po files (many listed the wrong language, all of
  them copied my incorrect use of PACKAGE (instead of saying "Subsurface").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-14 20:47:00 -07:00
Miika Turkia
a3e7a46f12 Change character encoding from iso-8859-1 to UTF8
Finnish translation was with wrong character encoding resulting in
compile error.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 17:04:43 -07:00
Dirk Hohndel
cb4bdfcea1 Improve German translations
The changes were mostly suggested by Lutz, but since he didn't send a
patch, I manually applied them.

Suggested-by: Lutz Vieweg <lvml@5t9.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 17:02:58 -07:00
Tommi Saviranta
8cc538ddd3 Add Finnish translation
This translation is partly based on Finnish Divers' Federation's printed
dive log and partly on my best guess. Some of the translated strings
have been (badly) shortened to fit the UI, and many others still neen be
shortened.

Signed-off-by: Tommi Saviranta <wnd@iki.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 09:29:09 -07:00
Ďoďo
d27eb4f503 Slovak translation
Also fixed two typos in the German translations.

Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-13 09:01:25 -07:00
Pierre-Yves Chibon
549425a692 Created first french translation of Subsurface
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:22:36 -07:00
Henrik Brautaset Aronsen
cfaa5563bf Better gettext build
My previous take at adding gettext to the Makefile wasn't very good,
since it always relinked the subsurface executable.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:17:09 -07:00
Linus Torvalds
920c1e58ff Add Swedish translation
This is a horrible mish-mash of the english and norwegian translation
and my random odd swedish translations of them.

It's bad. But it's a starting point. If somebody complains, they
hopefully say things like "That should be xyz" and it can be fixed.

[Dirk Hohndel: minor edit to the .po file to at least no longer claim to
               be Norwegian...]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:37:22 +09:00
Dirk Hohndel
efb1928d51 Add translation files to the Windows installer package
A lot more needs to happen for localization on Windows, but this is the
first step.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:33:24 +09:00
Lubomir I. Ivanov
fcb09c8078 Add Bulgarian translation
Some of the exact translations of terminology such as SAC (ППК) might
need a revision by an expert. Also, some of the things ended up being up
2-3 times longer (similar to German), so I'm not sure how this is going to
reflect on the UI.

[Dirk Hohndel: minor fixes to the .po file to make it compile]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:52:12 +09:00
Dirk Hohndel
5801dcf78b Use lang_COUNTRY.po naming convention for translation files
Rename nl.po to nl_NL.po

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:39:18 +09:00
Henrik Brautaset Aronsen
134c76ab80 Updated Norwegian translation
Added the missing translations for the File menu et al.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 06:32:26 +09:00
Dirk Hohndel
a68945646d Update German translations for newly added menu strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 23:15:08 +09:00
Dirk Hohndel
45e84618f5 Make translations of menu entries explicit
It appears that at least for Norwegian the translations of the stock menu
entries was missing. This patch adds those as explicit strings and merges
those new strings into the .po files.

The translations need to be updated in separate commits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 23:08:45 +09:00
Jacco van Koll
2a6db9c7ae Add Dutch localization
Signed-off-by: Jacco van Koll <jacco.van.koll@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 22:27:16 +09:00
Dirk Hohndel
d4a3ecedb0 Get divelist headers localized, too
This fixes an oversight in commit 881a2df83616 ("Conversion to gettext to
allow localization") - string literals that are marked with N_ need to be
converted when the corresponding variables are used at runtime. This was
missed for the divelist headers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 22:03:10 +09:00
Henrik Brautaset Aronsen
f5de37dbcf Basic gettext support when building
Added basic support for building gettext locales in the Makefile.
The po file name should match the target locale.

[Dirk Hohndel: Used git mv to rename the German .po file]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:45:30 +09:00
Henrik Brautaset Aronsen
21dec2a134 More gtk-mac-bundler improvements
Without "-headerpad_max_install_names", gtk-mac-bundler would complain
with "changing install names or rpaths can't be redone for:
/Applications/.subsurface.app/Contents/MacOS/subsurface-bin (for
architecture x86_64) because larger updated load commands do not fit"

Also, libdivecomputer needs to be configured with --with-prefix=/opt/local

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:37:54 +09:00
Henrik Brautaset Aronsen
870978331e Add Norwegian Bokmål translation
This file was created with "msginit --locale=no_NO --input=deutsch.po"
and edited with poedit afterwards.

The correct locale for Norwegian Bokmål really is nb_NO, but this is
a new-ish construct, and that locale doesn't seem to be available
on MacOSX.  We might need to create .mo files in both
locale/no_NO.UTF-8 and locale/nb_NO.UTF-8 to satisfy all platforms.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:27:30 +09:00
Linus Torvalds
94c98865a7 Improve on the DivingLog importer a bit
This adds a few fields that we parse, but more importantly it also tries
to dynamically decide if the sample temperatures and pressures are in
imperial or metric units.

Dirk suspects that DivingLog generally always does everything in metric,
and the reason why he has crazy sample data in imperial units (both for
pressure and temperature) may be due to a bug in the early Uemis
importer for DivingLog.

Which would actually make a lot more sense than DivingLog really being
so insane on purpose.

Anyway, Dirk's brother Jurgen seems to have everything in metric units,
which would be much saner.  Maybe we should throw away the support for
insane DivingLog files entirely, since it is possible that the only use
ever of the possible source of that bug was Dirk's use of the Uemis
importer.

But for now, we end up just guessing. Current guesses:

 - water temperature is below 32 dgC, so 32+ degrees is in Fahrenheit.

 - tank pressures are below 400 bar, so higher values than that must be
   psi.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 15:13:39 +09:00
Dirk Hohndel
99846da77f Conversion to gettext to allow localization
This is just the first step - convert the string literals, try to catch
all the places where this isn't possible and the program needs to convert
string constants at runtime (those are the N_ macros).

Add a very rough first German localization so I can at least test what I
have done. Seriously, I have never used a localized OS, so I am certain
that I have many of the 'standard' translations wrong. Someone please take
over :-)

Major issues with this:

- right now it hardcodes the search path for the message catalog to be
  ./locale - that's of course bogus, but it works well while doing initial
  testing. Once the tooling support is there we just should use the OS
  default.

- even though de_DE defaults to ISO-8859-15 (or ISO-8859-1 - the internets
  can't seem to agree) I went with UTF-8 as that is what Gtk appears to
  want to use internally. ISO-8859-15 encoded .mo files create funny
  looking artefacts instead of Umlaute.

- no support at all in the Makefile - I was hoping someone with more
  experience in how to best set this up would contribute a good set of
  Makefile rules - likely this will help fix the first issue in that it
  will also install the .mo file(s) in the correct place(s)

  For now simply run

  msgfmt -c -o subsurface.mo deutsch.po

  to create the subsurface.mo file and then move it to
  ./locale/de_DE.UTF-8/LC_MESSAGES/subsurface.mo

  If you make changes to the sources and need to add new strings to be
  translated, this is what seems to work (again, should be tooled through
  the Makefile):

  xgettext -o subsurface-new.pot -s -k_ -kN_ --add-comments="++GETTEXT" *.c
  msgmerge -s -U po/deutsch.po subsurface-new.pot

  If you do this PLEASE do one commit that just has the new msgid as
  changes in line numbers create a TON of diff-noise. Do changes to
  translations in a SEPARATE commit.

- no testing at all on Windows or Mac
  It builds on Windows :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 10:03:03 +09:00
Dirk Hohndel
a2afe41280 A file that we import should never become the default file we save to
Only files that are opened should be considered r/w. Files that are
imported should be treated as if they were r/o.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 21:50:16 +09:00
Lubomir I. Ivanov
ffd3b8591d subsurface.nsi: install program shortcuts for all users
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.7.7:
"Sets the context of $SMPROGRAMS and other shell folders. If set
to 'current' (the default), the current user's shell folders are used.
If set to 'all', the 'all users' shell folder is used"

Specific to the Windows installer.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 16:32:05 +09:00
Dirk Hohndel
856e10ddb2 Add trip above adds all consecutive selected dives to the new trip
Before this commit we had the odd behavior that if we right clicked in the
middle of a group of selected dives, the trip was added above the dive we
clicked on, not above the group.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09 16:32:05 +09:00
Dirk Hohndel
14856aab4b Bump version to 2.0.1
That crash is far too easy to hit for people just trying out subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-07 21:02:48 +09:00
Dirk Hohndel
1a6cf2f128 Fix potential crash when attempting to free default font
Before setting a new font we try to free the existing font. Sadly if no
config value is set for the default font, we assign a string literal.
Which of course means that subsurface dumps core when trying to free it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-07 20:57:24 +09:00
Dirk Hohndel
b4c11a7ed3 Turn menu and button images on regardless of OS settings.
Right now the menu and button images are a distribution choice - some
have them on, some have them off. I kinda like them and think that even on
OSs that have them off by default this doesn't look out of place (as other
apps clearly do the same).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-06 05:26:55 +09:00
Lubomir I. Ivanov
3e7780e7cd Added unicode support for the configuration entries on Windows
windows.c:

Windows's registry (which is technically a filesystem) uses UTF-16
for its "keys". This forces us to convert each of our UTF-8 (GLib, GTK)
configuration entries if we want to store special characters. To do that
we use the RegQueryValueExW() and do some conversation around
the function call itself.

The opposite happens when we require a UTF-16 value to be read from the
registry and converted to UTF-8 in subsurface_set_conf().

An addition to this patch is a somehow expandable buffer in
windows.c: subsurface_get_conf(). We increase the size of the buffer
in chunks of 64 bytes, until RegQueryValueExW() is able to write to it
(as suggested by the WINAPI documentation).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-05 23:44:54 +09:00
Lubomir I. Ivanov
b272fb8c3b Fixed some memory leaks related to string configuration entries
Each time we retrieve a string configuration entry via
subsurface_get_conf(), all the multiplatform methods in linux.c,
macos.c, windows.c allocate memory for the returned value.

In gtk-gui.c, lets try to release the memory at:
default_dive_computer_vendor, default_dive_computer_product, divelist_font
before assigning a new address to these pointers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-05 23:44:37 +09:00
Lubomir I. Ivanov
f928be5061 Provide a method to use unicode command line arguments on Windows
For unicode command line characters Windows uses UTF-16, while Glib
and GTK use UTF-8. To solve that we retrieve the command line
via __wgetmainargs() and use g_utf16_to_utf8() to convert each argument.

The used method should support wildcards passed as arguments
(e.g. *.xml).

Two new, OS abstracted functions appear in linux.c (NOP), macos.c (NOP),
windows.c:

subsurface_command_line_init(...)
subsurface_command_line_exit(...)

which are being called in main()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04 03:12:19 -07:00
Dirk Hohndel
3917e7b2f7 Force subsurface.sh on Mac to use bash
This was in a patch set from Henrik but got dropped at first while we
explored a different solution. So now it comes back as maybe the most
trivial commit, ever :-)

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04 03:07:22 -07:00
Henrik Brautaset Aronsen
29e19cdfb7 Add readme file for MacOSX package
There are a couple of gothas on MacOSX involving GateKeeper on
Mountain Lion, and dialogues that sometimes doesn't pop up.  This
file explains that.  The file should be included in the DMG, but that's
for a different commit.

[Dirk Hohndel: fix whitespace and some rephrasing]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04 03:01:27 -07:00
Lubomir I. Ivanov
4f18f83ce9 Use GLib's g_fopen() and g_open() when working with files
On Windows, the GLib wrappers for fopen() and open() deal with the UTF-8
format used for file names when we have to open or save a file with
unicode characters in its name.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04 02:43:10 -07:00
Dirk Hohndel
f3b9a37fb2 More fixes to MacOS bundle file and README
This still seems to fail to open the icon in the About screen in some
cases, but we don't quite understand why...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-02 12:13:19 -07:00
Henrik Brautaset Aronsen
eba4b86788 Fix typos for MacOSX packaging scripts
Fixed a couple of typos.

[Dirk Hohndel:	I took the typo fixes, but not the change of shell used;
		rewrote the commit message accordingly]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-02 11:12:28 -07:00
Henrik Brautaset Aronsen
fec749c1b4 Rename Import XML File menu entry
Renamed to "Import XML File(s)", since we can import more than one file.

H

From 8f9b11d940d903316dcf4d023e327f365e4f4ccb Mon Sep 17 00:00:00 2001
From: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Date: Tue, 2 Oct 2012 11:38:56 +0200
Subject: [PATCH] Rename Import XML File menu entry

Renamed to "Import XML File(s)", since we can import more than one file.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-02 11:11:21 -07:00
Lubomir I. Ivanov
5468f19a05 Fixed potential, rare corruption of unicode characters
In divelist.c:get_string(), when truncating the string to a maximum
of 60 characters (to be shown in the divelist), make sure we are
counting in guinchar (sizeof usually 2) instead of gchar (sizeof usually 1).
Use Glib functions such as g_utf8_strlen() and g_utf8_strncpy() to do that.

This patch fixes the potential problem when truncating a UTF-8 string
by calculating its length using strlen() in bytes.

For char = 1 byte, if the length returned by strlen() is an odd number
this means there is at least one single byte length character in there.

But also if the same string has a UTF-8 character at exactly the truncate
position minus x(probably 1) bytes, we are going to split the bytes
forming said UTF-8 char resulting in an incorrect string.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-02 10:11:16 -07:00
Lubomir I. Ivanov
f2adb0cea6 fixup_dive(): move the add_* calls before a possible return
In dive.c:fixup_dive() it would be better to call functions
like add_people() and add_location() before the possible return
in the "if (end < 0)" branch.

This prevents a partial auto-complete list in "Dive Info"
combo boxes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-02 09:27:14 -07:00
Lubomir I. Ivanov
fa5afc697e Fix memory leaks related to dive_trip->location
When creating a new dive_trip from a dive, we should probably
always copy the location via strdup(). However we then have to take
care of the de-allocation in divelist.c:delete_trip()
and gtk-gui.c:file_close().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01 20:56:17 -07:00
Lubomir I. Ivanov
cfefa0206d Destroy the divelist (tree) before calling gtk_main_quit()
Added new function dive_list_destroy() in divelist.c

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01 20:55:28 -07:00
Lubomir I. Ivanov
7f01b91c99 Fixed memory leaks specific to divelist.c
move_dive_between_trips() always returns a pointer to a new
allocated memory block of size = GtkTreeIter. Lets free said memory
when no longer needed in the caller functions.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01 20:53:52 -07:00
Dirk Hohndel
73f290be8f Add packaging files for MacOS
I couldn't figure out how the current packaging infrastructure was supposed to
work, but with not too much work I could get the more standard gtk-mac-bundler
to do what I wanted, so I added the support files needed for that and a little
README on how to use them.

The subsurface.sh and subsurface.bundle files are based on the launcher.sh
and gtk-demo.bundle files from the gtk-mac-bundler release which is under GPLv2.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01 20:47:50 -07:00
Lubomir I. Ivanov
0559a6a783 Fixed some small memory leaks
Looks like a GtkEntryCompletion object created with
gtk_entry_completion_new() should be unreferenced after usage
(e.g. post gtk_entry_set_completion())

In info.c:get_combo_box_entry_text(), moved the free(..) line outside,
so that we can free regardless.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-01 14:06:46 -07:00
Linus Torvalds
3244a828f3 New XML format for saving dives
This patch makes the trips nest, and it also fixes the fact that you never
saved the trip notes (you could edit it, but saving would throw it away).

I did *not* change the indentation of the dives, so the trip stuff shows
up the the beginning of the line, at the same level as the <dive> and
<dives> thing. I think it's fairly readable xml, though, and we haven't
really had proper "indentation shows nesting" anyway, since the top-level
"<dives>" thing also didn't indent stuff inside of it.

Anyway, the way I wrote it, it still parses your old "INTRIP" stuff etc,
so as far as I know, it should happily read the old-style XML too. At
least it seemed to work with your xml file that already had the old-style
one (I haven't committed my divetrips, exactly because I didn't like the
new format).

It always saves in the new style, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-30 12:36:18 -07:00
Dirk Hohndel
946d9c7166 ENOTENOUGHCOFFEE
Third attempt to get this trivial memory leak fix right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-30 09:12:53 -07:00
Dirk Hohndel
02bfd2d9ea Better fix for one of the memory leaks
The return value of subsurface_get_conf is a const void * - so we shouldn't
just assign it to a variable where we know it will be changed. Instead we
duplicate the string and free the original one. A little less efficient but
cleaner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-30 09:01:15 -07:00
Dirk Hohndel
24c6197c10 Fix a number of obvious memory leaks
Just the result of cppcheck and valgrind...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-29 20:58:26 -07:00