Commit graph

1681 commits

Author SHA1 Message Date
Henrik Brautaset Aronsen
8e673e4618 Let's do another Norwegian translation update for 3.0
Added one string, improved some of the others after inspecting
the source code locations.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:43:04 -08:00
Miika Turkia
cbc818ddfe Include SDE files on file selector
Include SDE files on the file selectors if zip support is enabled.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:42:46 -08:00
Henrik Brautaset Aronsen
b1c01f62ea Add libzip to MacPorts dependencies
This adds support for SDE imports.  The website documentation should
be updated as well.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:37:07 -08:00
Lubomir I. Ivanov
d2305b0c01 Updated bg_BG translation
+ new string for map widget
+ fixed missing dot after shortened word

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:31:28 -08:00
Sergey Starosek
1dcde35c9e Updated Russian translation for latest strings
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:30:47 -08:00
Jozef Ivanecký
75490b22ec Finished and fixed sk_Sk
Signed-Off-By: Jozef Ivanecký <dodo.sk@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-12 08:23:17 -08:00
Dirk Hohndel
f50ae3a689 Update German and Swiss-German translations for latest strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 20:19:33 -08:00
Dirk Hohndel
9166dab702 Another strings update
This should re-enable to text for "Gas Used" and introduces the new text
for the map window title from commit 21401578c620 ("Add instructions to
GPS map window title").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 19:54:43 -08:00
Dirk Hohndel
4ed41dd49f Add instructions to GPS map window title
This is not what I really wanted (which was the ability to add text to the
map itself), but it should be at least somewhat better than what we have
today (which is a complete lack of instructions).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 19:52:44 -08:00
Lubomir I. Ivanov
c92d5d2e66 print.c: Attempt a gettext() fix when printing translated "Gas Used"
print_tanks():
It seems the macro call NC_("Amount","Gas Used") generates an entry in the
.po file that then isn't matched at run time, which makes the bg_BG print
have "Gas Used" in english instead of the translated text (which is
already present in other places).

On the other hand if we use N_ here (only mark it), the printed text
is translated correctly.

[Dirk Hohndel: added GETTEXT comment in code and rephrased commit message]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 11:33:04 -08:00
Lubomir I. Ivanov
3cb51b948a print.c: Fix more buffer lengths
print.c has a lot of defined buffer sizes, which do not consider
UTF-8 expansion. gettext() with UTF-8 can inflate a string up to
2x the length (with 2byte characters).
So if you set a buffer with length, say 20 bytes, lets see what happens:

divenr[20];
snprintf(divenr, sizeof(divenr), _("Dive #%d - "), dive->number);

But wait, in Russian "Dive" (which in latin text is "Pogrugenie")
ends up with 10 cyrilic characters (20 bytes), so there is already
buffer overflow here and snprintf() kicks in to corrupt the string.

In matters of truncation snprintf() isn't UTF-8 safe.
So if the buffer size happens to be less of the requested string
to be put in there, the truncation can corrupt a trailing unicode
character.

For now, lets try fixing these by expanding the buffer sizes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 11:27:21 -08:00
Lubomir I. Ivanov
02f9df4271 bg_BG.po: Small reformating of a (Dive# - data, time) string for print.c
In printed dives (6x per page) the <Dive # - data, time> string
had an extra comma after the hyphen.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 11:25:04 -08:00
Sergey Starosek
9d21f6a670 New translations and several bug fixes for Russian.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-11 09:30:33 -08:00
Dirk Hohndel
e5985b9657 Remove "target ring" in map display
This could easily lead to confusion that this is where a dive spot would
be marked (instead of the location of the mouse during right click).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 12:48:41 -08:00
Linus Torvalds
05990b107d Fix saving of changed GPS entry
We can't use gps_changed() in the gps_map_callback function, because that
will actually change the GPS data in the dive being edited, which in turn
will then cause us to later (when we *really* want to change it) not match
the master dive data any more, and think we shouldn't edit the dive at
all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 12:10:26 -08:00
Linus Torvalds
68eca79dfd Fix rounding of GPS coordinates
The whole "+ 0.5" to round to integers only works for positive values,
and GPS coordinates are signed.

So use the proper "round to int" function (rint()), which does this correctly.

Also, remove the redundant check against the master gps values: we
already checked that if we do have a master dive, the gps values must
match the currently edited dive, so comparing against the master is
entirely redundant.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 11:55:45 -08:00
Salvador Cuñat
b652d4e1ab [PATCH] Print.c: Modify for using pango_layout_get_extents
Modify for use said pango function, suposes changing the way of doing things:
Before this we were moving along the cr (cairo object) and creating and closing a layout
for each line we printed. To use this func we need to create a layout (say for tanks),
and then we move along the layout getting the distance with the get_extents func.
As the layout is set and passed to the auxiliary functions  there's no need to pass some
values we were passing.

Clean a bit the positioning of  SAC, CNS and OTU which were out of the scope of the
change.

Changes to draw_table() are wider and unclear as we have to change from a fixed
number of dives (25 actually) to a variable one.  Not patched still.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 10:46:37 -08:00
Miika Turkia
0fb2ee0f1a Updates on Finnish translation
A couple of bug fixes and new translations. I also took the fuzzy
marking from strings that look like proper translations.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-10 10:40:08 -08:00
Miika Turkia
0747705617 The print header should read Duration
The context for this text is Duration, not Time. The translation for
string Time was impossible when considering that on one location it was
used to mean 'duration' and on the other it meant 'time'.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 22:04:27 -08:00
Lubomir I. Ivanov
f0f752b74c Updated bg_BG translation for 3.0
- Added translations for pretty much everything new since the last iteration

- Removed most usages of tags where both words begin with upper case
letters. For example, "Some Tag" may look OK in English, but not so good
in other languages. It's much better to have it as "Some tag" in Bulgarian.

- Reverted some of the made-up abbreviations (such as the one for SAC)
to the default English ones (i.e. just SAC). I'm not exactly sure those
made any sense at all, so lets have them in English, as a little precaution.

Hopefully enough for the 10-15 (in total) Bulgarian diving nerds
out there. :)

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 22:04:07 -08:00
Henrik Brautaset Aronsen
37364fb40a Make map dot more visible
The OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID shows cities as red dots
in a couple of the zoom levels.  Make the dive dots larger and
yellow to make them stand out.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 13:16:10 -08:00
Linus Torvalds
94546acc94 Fix up Swedish translation for recent po changes
Minimal fixups just to make things happier. Fredrik will hopefully
double-check and fix this up further, but at least we have *some* string
for the planning warning etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 12:53:41 -08:00
Henrik Brautaset Aronsen
8af8162809 Switch to satellite image map provider
The current google map provider doesn't show coast lines properly and
a lot of islands aren't shown at all.
OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID is much better IMHO.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 12:44:05 -08:00
Reinout Hoornweg
5ce9d7603b Updates to Dutch translation
Translated some new strings.
Fixed a typo in one of my earlier translations

Signed-off-by: Reinout Hoornweg <reinout@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 12:04:41 -08:00
Dirk Hohndel
2f059c8b81 Replace deprecated gdk_pixbuf_unref with g_object_unref
This appears to be the better API call to do this (according to online
documentation and compiler warnings on Linux).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:48:12 -08:00
Lubomir I. Ivanov
df8fb3be98 gps.c: Make two more memory leak fixes and a small coding style change
1)
add_gps_point():
Apparently osm_gps_map_point_new_*() is leaking memory if the
point struct is not freed after the point is added to the
map osm_gps_map_track_add_point().

However the API for releasing a point is missing on
older Windows builds of the map library, so instead of
osm_gps_map_point_free() we simply call:
	free((void *)point);

2)
init_map()
According to memory management tools
osm_gps_map_get_default_cache_directory() is using g_realloc
for eventual string expansion therefore we have to release at the
returned pointer.

3)
add_gps_point()
Also a small coding style change is made:
move the pointer symbol (*) near the name of the variable
instead of leaving spaces on both sides, like:
<type> * <name>

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>

...

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:41:20 -08:00
Lubomir I. Ivanov
801b0832ae gps.c: Use only one instance of the map object and window
Both show_gps_locations() and show_gps_location() have
static local variables 'map' (OSM_TYPE_GPS_MAP) and 'window',
so technically both would create their own instances of these
objects.

This patch promotes the two variables to global, so that only
one instance per type ever exists.

A memory leak that is addressed is at the flag pixbuf
allocation, which has to be freed right after the image
is added to the map:
picture = gdk_pixbuf_from_pixdata(&flag_pixbuf, TRUE, NULL);
...
gdk_pixbuf_unref(picture);

There is also a heap-lifespan memory leak at:
map = g_object_new(OSM_TYPE_GPS_MAP,...
but GLib isn't exacly happy about us unrefing it right before
exiting the GTK main loop, so no fix is provided for that
unfortunately.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:40:55 -08:00
Lubomir I. Ivanov
ea21126f62 Fixed a memory leak related to the satelite icon
divelist.c:get_gps_icon_for_dive()
In all callers of the function use gdk_pixbuf_unref() to
release the returned GdkPixbuf (but also check for NULL).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:40:20 -08:00
Lubomir I. Ivanov
363c38f557 Fixed some memory leaks in divelist.c related to gtk_tree_iter_copy()
divelist.c:
get_iter_from_idx() goes trought the tree model and calls
iter_has_index(), until a match is found. when the match is found
we use gtk_tree_iter_copy() to make a copy of the iterator.

This means that the caller of get_iter_from_idx() has to take care
the de-allocation using gtk_tree_iter_free().

Also take care of the eventual:
parent = gtk_tree_iter_copy(...)
allocation in select_prev_dive(), select_next_dive()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:40:03 -08:00
Lubomir I. Ivanov
3848cac30f Fixed a memory leak in webservice.c
webservice.c:webservice_download_dialog()
If a value for previous UID is returned from the user config
via subsurface_get_conf("webservice_uid"), make sure to
free the string near the function return.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:39:42 -08:00
Lubomir I. Ivanov
2af818bf91 Fixed some memory leaks in windows.c and main.c
windows.c:subsurface_gettext_domainpath():
- memory at pointer returned from g_win32_getlocale() should be released

main.c:setup_system_prefs()
- it seems all calls to <os_file>:system_default_filename()
return a pre-allocated buffer, therefore we don't need to call strdup()
on the result itself.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:38:51 -08:00
Henrik Brautaset Aronsen
a4ae0a4650 Probably the final Norwegian PO-file update before 3.0
Yeah, right :)

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 11:32:32 -08:00
Dirk Hohndel
a40e56dc8c Updated Swiss German translation
Just to show the advantage of running make prepare-po-files before
submitting a patch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 10:54:02 -08:00
Dirk Hohndel
16dda3ec12 New Makefile target to create smaller diffs for translations
Simply run

make prepare-po-files

and msgcat will be run over all po files to create consistent location
references. That plus the change I made earlier to how we update the po
files should create much smaller and easier to read diffs for translators.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 10:52:01 -08:00
Dirk Hohndel
e7389874fb Updated German translation
This translation update was done with poedit which usually creates hugh
amounts of noise because of the different format of text location
references. By post-processing the file with

msgcat --no-wrap po/de_DE.po -o po/de_DE.po

the diff becomes MUCH smaller and much easier to read...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 10:46:07 -08:00
Dirk Hohndel
9d9eff718b Hopefully last change to po files
While this is a pain for everyone, I decided not to edit out the code
reference noise - after all this is supposed to help translators find
where the text is used in case it's unclear how to translate something.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 10:39:11 -08:00
Dirk Hohndel
460060c430 Small update to German translation
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 10:11:20 -08:00
Miika Turkia
752ee66968 Improvements on MacDive import
New information of the upcoming MacDive log format is taken into account, more
Imperial conversions are added and a couple of bugs fixed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:49:31 -08:00
Henrik Brautaset Aronsen
312f553aee Enable XSLT transforms on OSX
We still need proper paths and install options for the install-macosx
and create-macosx-bundle targets.  This enables XSLT support when
running as ./subsurface, but doesn't hurt the other install targets.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:48:16 -08:00
Henrik Brautaset Aronsen
eb7acc1d96 Add XSLT support for the macosx install and bundle targets
Works like it should for the install-macosx target.  I haven't tested
the create-macosx-bundle target, but it shouldn't be any different.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:44:51 -08:00
Martin Gysel
fe87ed182e Updates to German translation
resynced with de_CH, some spelling bugs fixe,
improved translation (hopefully)

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:42:43 -08:00
Martin Gysel
adb997f5ff Updates to Swiss German translation
synced with de_DE, fixed some bugs

Signed-off-by: Martin Gysel <m.gysel@consonics.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 09:42:39 -08:00
Dirk Hohndel
ebcbe5aedd Finish removing accesses to first divecomputer instead of dive
This adds watertemp and airtemp to the dive, populates them in fixup and
uses them elsewhere in the code.

WARNING: as a sideeffect we now edit the airtemp in the dive, but we never
display this in the DIve Info notebook (as that always displays the data
from the specific selected divecomputer). This is likely to cause
confusion. It's consistent behavior, but... odd. This brings back the
desire to have a view of "best data available" for a dive, in addition to
the "per divecomputer" view. This would also allow us to consolidate the
different pressure graphs we may be getting from different divecomputers
(consider the case where you dive with multiple air integrated computers
that are connected to different tanks - now we could have one profile with
all the correct tank pressure plots overlayed - and the best available (or
edited) data in the corresponding Dive Info notebook.

This commit also fixes a few remaining accesses to the first divecomputer
that fell through the cracks earlier and does a couple of other related
cleanups.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 07:41:15 -08:00
Dirk Hohndel
b9865d6bbc Move duration to dive structure and replace accessor function
When starting on this quest to stop using the first divecomputer instead
of data for the whole dive in commit eb73b5a528c8 ("Duration of a dive is
the maximum duration from all divecomputers") I introduced an accessor
function that calculates the dive duration on the fly as the maximum of
the durations in the divecomputers.

Since then Linus and I have added quite a few of the variables back to the
dive data structure and it makes perfect sense to do the same thing for
the duration as well and simply do the calculation once during fixup.

This commit also replaces accesses to the first divecomputer in
likely_same_dive to use the maxdepth and meandepth of the dive (those two
slipped through the cracks in the previous commits, it seems).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 07:19:29 -08:00
Dirk Hohndel
c7efcb23a9 Add a meandepth to the dive structure
This is currently only used in one place (in statistics.c), but it
certainly is consistent with the other recent changes to avoid using only
the first divecomputer when trying to make statements about a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 07:02:43 -08:00
Dirk Hohndel
0755cc522b Show the actice divecomputer's data in the Info notebook
While the profile switched between different divecomputers, the Dive Info
notebook always showed either information from the first divecomputer or
(with some of the recent changes) information that had been collected from
all divecomputers and somehow consolidated for the dive.

With this commit we now show the data from the same divecomputer that is
also shown in the profile (which means if some data is available from one
of the divecomputers and not from another that will be correctly reflected
in the Dive Info notebook as the user cycles through the divecomputers.

This does beg the question if we should have some kind of "best data
available, considering all divecomputers" mode - but that's definitely not
something I'll tackle prior to 3.0.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 06:17:25 -08:00
Dirk Hohndel
9e66312d6a Initialize variables in helper functions
In commit 904aa0be0d0e ("Do more dive fixup for each dive computer") two
new helper functions were introduced that sadly both incremented variables
without initializing them, first.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09 05:45:58 -08:00
Dirk Hohndel
1511271201 Add maxdepth back to the dive structure
Populate during dive fixup as the maximum depth shown by all the
divecomputers. Use this value (instead of the one in the first
divecomputer) in printing, statistics, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-08 20:44:04 -08:00
Dirk Hohndel
b8c7992bbf Improve calculation of maxtemp and mintemp of dive
The existing code only populated the maxtemp based on the samples of a
dive and then in statistics.c checked if there was no such temperature and
replaced it with the water temperature of the first divecomputer.

It makes much more sense to add the water temperature information in every
divecomputer to the min / max calculation during the dive fixup phase.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-08 20:14:13 -08:00
Dirk Hohndel
51f97a97ce Avoid using float when dealing with GPS location
Float values have insufficient precision compared to the udeg we usually
store - so we create a special callback function to use from osm-gps-map
and everywhere else use integers.

This patch also increases the decimal places displayed in the GPS text
entry box - this way we can cut and paste the text without loss of
precision.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-08 19:30:30 -08:00