This literally just creates the dialog and does not hook things up with
the dive list.
The idea is to abstract out the idea behind the invalid dives to allow the
user to select / deselect all kinds of dives and then do statistics on
the selected ones.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the downside of having to track our own selection state. We now
have a class of dives that potentially isn't known to Gtk as we aren't
adding them to the TreeView. So we need to make sure that their selection
state is consistent by deselecting them (either when they are marked as
invalid OR when we change preferences to no longer show invalid dives).
And because Gtk sends out another set of selection events when clearing
the TreeView (not sure why), we also need to make sure that their
selection state isn't reset to selected by mistake when the divelist is
recreated.
A bit of a pain, but it seems to work now and be consistent.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only call upload_all_dives_divelogs_cb() if we have both libzip and xslt.
Reported-by: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The menu entry for upload to divelogs.de was missing. Also renamed
the divelogs context menu entry to something less generic.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This started out as a way to keep dives in the dive list but being able to
mark them as 'invalid' so they wouldn't be visible (with an option to
disable that feature).
Now it supports an (at this point, fixed) set of tags that can be assigned
to a dive with 'invalid' being just one of them (but one that is special
as it gets some additional support for hiding such dive and marking dives
as (in)valid from the divelist).
[Dirk Hohndel: merged with the latest code and minor changes for coding
style and consistency. Ensure divelist is marked as
modified when changing 'invalid' tag]
Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most of the warnings are IMHO false positives:
e.g.: an enum variable is initialized in a switch statement that has a case for
each possible enum value - yet gcc 4.8 warns that it could be used
uninitialized;
or: two variables are initialized together in the code - second one of them
is previously initialized to -1 at declaration time, both are initialized
in an if (second one == -1) clause - so they are guaranteed to both be
initialized...
I did not "fix" those as the code is actually correct.
But there are three spots where it catches things that could indeed go wrong
(with odd input data in one of them).
This commit also adds a check to only call g_type_init() for older versions of
glib as in newer ones it is deprecated.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove the boolean parameter from parse_file; the code is more readable
by having an explicit call to set_filename() where necessary, rather
than a boolean parameter.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
In save_window_geometry() use gdk_window_get_state() to retrieve
the window maximized state and store it in the user configuration.
Then in restore_window_geometry() restore the maximized state with
gtk_window_maximize(), if needed.
To achieve good results we also need to override "window-state-event"
for the main window and define an extra couple of configuration parameters:
"vpane_position_maximized" and "hpane_position_maximized".
Then store two different pane states for maximized and restored window each
time the user makes a switch.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch implements exporting dives from Subsurface to UDDF format.
Events and cylinder info are the most remarkable things still missing
from the export.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To make this easier I created a new helper function create_label that
takes printf style arguments. I assumed this would be usable in many
places but ended up finding just one other obvious use for it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As logical extension of the ability to add bookmarks and gas changes this
adds the ability to remove (any arbitrary) event that happens at the mouse
position (specifically, that is within +/- six (scaled) pixels around the
x-position (time) of the mouse). That's the same width that the triangle
marker occupies which was moved to be centered around the event time in
commit 5752e9742e86 ("Finetune event triangle position to have the top
point at the event time").
Fixes#60
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use the infrastructure created for manually adding gas change events to
also be able to add bookmarks.
[Dirk Hohndel: This combines two commits for clarity. I also cleaned up
the indentation and changed the code to no longer print the
exact same text twice.]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a little widget that lists all the gases / tanks we know about and
allow the user to pick one of them.
Turns out that add_event only added events at the end of the list - but we
treat that list as chronologically sorted. So I fixed that little
mis-feature as well.
This does raise the question whether we need the inverse operation
(removing a gas change). And if there are other things that we should be
able to manually edit, now that we have the infrastructure for this neat
little context menu...
See #60 -- this doesn't address all of the issues mentioned there, but at
least deals with the 'headline' of the feature request...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is completely bogus as all it does is print out the corresponding
time for the spot we right-clicked on the profile. But that at least shows
that the infrastructure is working as intended...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The introduction of GtkComboBoxText usage for selecting a map provider,
removed support for older versions of GTK on distros like Debian 6.0.4.
Parent class (GtkComboBox) methods have to be used instead, around
more pre-processor branching.
This patch also fixes a small memory leak when retrieving text from said
combo box.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move the view submenu to a top level location.
Alter the wording of File|Import to drop XML qualifier; we import more
formats than this.
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Basic functionality is implemented but at least support for multiple
cylinders is missing. Event/alarm support is only partial.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We should test for being in PANE_THREE mode in save_pane_position() and
replace the if()'s testing against window geometry. This eliminates some
code duplication and, more importantly, save_pane_position() is also
called from save_window_geometry() whose calling pattern is not obvious.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We tried to detect this without needing a global variable but that clearly
was too dependent on decorations that the window manager might add. This
code works reliably.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A couple of these could clearly cause a crash just like the one fixed by
commit 00865f5a1e1a ("equipment.c: Fix potential buffer overflow in
size_data_funct()").
One would append user input to fixed length buffer without checking.
We were hardcoding the (correct) max path length in macos.c - replaced by
the actual OS constant.
But the vast majority are just extremely generous guesses how long
localized strings could possibly be.
Yes, this commit is likely leaning towards overkill. But we have now been
bitten by buffer overflow crashes twice that were caused by localization,
so I tried to go through all of the code and identify every possible
buffer that could be affected by this.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Argh. Maxint is not at the bottom or at the right. We have to check
against the size of the window to determine we are not saving a maximized
position. Here is a fix.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Closing unsaved dive raises Save dialog with Yes/No/Cancel buttons.
Pressing ESC dismisses dialog without saving changes.
This commit adds GTK_RESPONSE_DELETE_EVENT response code check in order
to fix that behavior.
Reported-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Not all of the providers seem to work for me (Yahoo Satellite doesn't
appear to give me any data), but for now I'll leave most of them in.
We can later decide to offer only some of them.
It might be more fun to be able to pick the provider directly from the map
widget. But for now I kept this in the preferences which seemed to be a
good place for it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also make sure the config is flushed to disk.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit has gone through a few iterations and I trimmed it down to
what I consider the "conservative minimum" - so this only stores window
size, not window position. And in my mind that's the more relevant part,
anyway. Have your window manager position the window at a "smart" spot on
your screen...
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some functions in combo_box_with_model_and_entry() are only
available to GTK 2.24 and newer. This patch adds only one #if branch,
but probably adds support to a number of outdated distributions,
such as Debian 6.0.4 and Ubuntu 10.04.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Calling set_dc_nickname() only added a new entry if there was a conflict
with an existing one - which works fine if we are reading a file saved by
Subsurface, as there the device_info_list is populated at parse time, but
fails for data imported from other sources.
Fixes#74
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is dedicated to Lubomir ;)
Should work (tm). Not sure though if you want target
'gen_version_file' as a pre-requisite to $(NAME) or some other target.
[Dirk Hohndel: minor adjustments to make it work with gtk-gui.c]
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Yes, we could try and bundle the user manual with the executables and open
a local copy of it - but this seemed much easier and safer to do. It does,
of course, add another string...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Uses profile.c:evn_foreach() to retrieve the number of events, which
if zero, no table is added in the dialog and the label is added instead.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is a bug in GTK 2.2x where the links in the about dialog
(and URI's in general) do not work on Windows. To solve that
we add the OS specific method subsurface_launch_for_uri().
But to dispatch URI requests from the about dialog we need to
set a hook either with gtk_about_dialog_set_url_hook() (which is
deprecated from 2.24) or using signals like "activate-link".
One problem with the "activate-link" signal thought is that
we need to have a reference of an about dialog to pass to
g_signal_connect(). So instead of using gtk_show_about_dialog()
let's manage a dialog ourself with gtk_about_dialog_new(),
gtk_dialog_run(), gtk_widget_destroy().
Other changes:
- for GTK _bellow_ (but not including) 2.24 use
gtk_about_dialog_set_url_hook()
- use g_object_set() which is a convenient replacement for
the varargs list in gtk_show_about_dialog() (also makes the diff smaller).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The about dialog URI calls are broken on Windows, therefore we needed
a way to override the default URI method. On versions bellow or equal to
GTK 2.24 this is possible with gtk_about_dialog_set_url_hook(),
which on the other hand is deprecated for newer GTK versions.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently at least in Unity on Ubuntu 12.10 using those icons causes the
default Menu text to be displayed (Back instead of Import).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a new method in info.c called info_widget_destroy(), which
clears all GtkListStore instances. The method is exposed via
display-gtk.h and called from gtk-gui.c:on_destroy().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As Rainer finished up the export function on divelogs.de, he
used DLD as a suffix instead.
Suggested-by: Rainer Mohr <mail@divelogs.de>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead, just keep track of the expanded state of trips as we get the
gtk callbacks for the state changes (which we need to track anyway for
the selection logic), and automatically restore the state whenever we
re-create the divelist.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just adds the "remember_tree_state()" and "restore_tree_state()"
calls around the divelist update when autogrouping is turned on: that
way existing expanded groups aren't blindly collapsed.
It makes it much easier to see what autogrouping does if it only groups
a few dives, because the overall state of the divelist isn't radically
changed.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
gtk-gui.c:
+ added the method get_screen_dpi() that uses a simple
formula to retrieve the actual screen DPI
display.h:
+ use get_screen_dpi() in the SCALE_PRINT macro
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Getting the about icon to display in various scenarios on MacOSX
was a pain. Moving the icon to an include file solved the problem.
This commit also fixes the problem Dirk was having when converting
satellite.svg to a png in commit cf3c0266c2. I couldn't
quite get ImageMagick to preserve transparency and color when
converting subsurface-icon.svg, though, so I used Gimp instead.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Another oversight of what needed to be done when cleaning up the UI after
closing the data file.
Reported-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>