aboutsummaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
AgeCommit message (Collapse)Author
2013-04-21Simplistic filtering by tagsGravatar Dirk Hohndel
This only allows for a logical "AND" - so only dives that all of the selected tags are displayed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21Add Gtk dialog to select the dives tags for which dives are shownGravatar Dirk Hohndel
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>
2013-04-10Fix selection handling for invalid divesGravatar Dirk Hohndel
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>
2013-04-09Correctly conditionalize compilation for menu structureGravatar Dirk Hohndel
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>
2013-04-09Add menu entry for divelogs.de uploadGravatar Henrik Brautaset Aronsen
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>
2013-04-09Add dive tags and support invalid divesGravatar Ďoďo
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>
2013-04-07Fix some of the gcc-4.8 warningsGravatar Dirk Hohndel
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>
2013-04-07Move set_filename() calls outside of parse_file()Gravatar Alberto Mardegan
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>
2013-03-26gtk-gui.c: Some small whitespace indentation fixesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26Store the main window maximized state in the configurationGravatar Lubomir I. Ivanov
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>
2013-03-24Export dives to UDDF fileGravatar Miika Turkia
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>
2013-03-19Make slider labels consistent in print dialogGravatar Dirk Hohndel
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>
2013-03-18Manually remove events in the profile context menuGravatar Dirk Hohndel
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>
2013-03-18Manually add bookmarks in the profile context menuGravatar Robert C. Helling
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>
2013-03-17Manually add gas changes to a diveGravatar Dirk Hohndel
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>
2013-03-17First step towards a context menu in the profile viewGravatar Dirk Hohndel
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>
2013-03-09Bring back support for GTK versions pre 2.24Gravatar Lubomir I. Ivanov
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>
2013-03-08Reorganise view menus and file import.Gravatar Amit Chaudhuri
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>
2013-03-05Add .jlb and .udcf as supported file typesGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-04Limited support for Suunto DM4 importGravatar Miika Turkia
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>
2013-03-04Improve pane position saving codev3.0.2Gravatar Robert C. Helling
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>
2013-03-03Only store pane positions if we currently display "View Three"Gravatar Dirk Hohndel
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>
2013-03-03Try to capture some more potential buffer overflows caused by localizationGravatar Dirk Hohndel
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>
2013-03-03Fix pane position bugGravatar Robert C. Helling
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>
2013-03-03Fix ESC key handling in Save dialog.Gravatar Sergey Starosek
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>
2013-03-02Save window pane positionsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-02Another unused variable warning when building without libosmgpsmap.Gravatar Cristian Ionescu-Idbohrn
gtk-gui.c: In function 'preferences_dialog': gtk-gui.c:670:30: warning: unused variable 'map_provider' [-Wunused-variable] Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-01Merge branch 'map-providers'Gravatar Dirk Hohndel
2013-03-01Make the map provider choice a preferenceGravatar Dirk Hohndel
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>
2013-03-01Remember window pane positionsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-28Add MacOS support to window geometry save/restoreGravatar Henrik Brautaset Aronsen
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>
2013-02-28Remember window sizeGravatar Amit Chaudhuri
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>
2013-02-27Added back support for versions of GTK pre 2.24Gravatar Lubomir I. Ivanov
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>
2013-02-27Add all dive computers to the device_info_listGravatar Dirk Hohndel
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>
2013-02-26Generate/update a version.h header file.Gravatar Cristian Ionescu-Idbohrn
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>
2013-02-25Add link to user manual to Help menuGravatar Dirk Hohndel
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>
2013-02-25Show a "No Events" label when there are no events in the filter dialogGravatar Lubomir I. Ivanov
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>
2013-02-25Don't use gtk_show_about_dialog() for the about dialogGravatar Lubomir I. Ivanov
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>
2013-02-25gtk-gui: Check if the GTK version is lower than 2.24 for the about dialogGravatar Lubomir I. Ivanov
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>
2013-02-23Remove substitute icons for Import and DownloadGravatar Dirk Hohndel
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>
2013-02-23Add uddf extension to file selector filterGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-20info.c: add a method to clear all GtkListStore allocationsGravatar Lubomir I. Ivanov
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>
2013-02-20Change divelogs.de export file suffix from .ZIP to .DLDGravatar Henrik Brautaset Aronsen
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>
2013-02-20Add unzip support to divelogs.de exportsGravatar Henrik Brautaset Aronsen
Finalize divelog.de import, used with Miiko's divelog.de xslt transform Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-19Obviate the need for explicit 'remember_tree_state/restore_tree_state' callsGravatar Linus Torvalds
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>
2013-02-19Remember pre-existing trip expansion state when autogroupingGravatar Linus Torvalds
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>
2013-02-12Include SDE files on file selectorGravatar Miika Turkia
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-07Use GDK methods to retrieve the actual screen DPIGravatar Lubomir I. Ivanov
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>
2013-02-02Move about icon to include fileGravatar Henrik Brautaset Aronsen
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>
2013-02-01Clear yearly statistics when closing data fileGravatar Dirk Hohndel
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>