Commit graph

126 commits

Author SHA1 Message Date
Dirk Hohndel
c15f798a85 Remove the ability to 'Import' .SDA files
We can instead 'Open' these files as they are just bastardized XML files.

This gets us back to a more consistent point where 'Import' gets data
directly from the dive computer (and hopefully soon we will add the
ability to load a dive directly from a uemis SDA to libdivecomputer),
and 'Open' loads a file from the filesystem of the computer we are
running on (this last sentence phrased so awkwardly as the uemis Zurich
SDA is a computer and presents a file system when connected via USB - it
just doesn't have the dive data in an accessible format in that file
system).

As a bonus we get to throw away quite a bit of code (the uemis specific
file handling, mini-XML parser with helper functions, the file open dialog
in the importer). Yay!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03 08:34:56 -07:00
Linus Torvalds
8d82c57e46 Split up generic code to generate a gtk tree view column
We used to do this just for the dive list, but the new cylinder view
will want to do a lot of the same boilerplate gtk stuff, so make it a
bit more generic and move it to gtk-gui.c.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-02 13:05:12 -07:00
Dirk Hohndel
d37d7211ca The notebook pages can only be dropped back into the main notebook
Disable the secondary notebooks that are created when ripping off a page
(dive_list or dive_profile) as drop targets for other pages.

Also fix the incorrect arguments for the drag callback function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 19:47:19 -07:00
Dirk Hohndel
79a866f5b4 Linus would like to be less on the bleeding edge of Gtk+
So we go back to the old interfaces to identify the notebook as part of
one group - the one that was just recently deprecated

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 17:11:08 -07:00
Dirk Hohndel
fda230235c Use the correct signal to avoid Gtk-CRITICAL error message
We used the wrong signal - "data-drag-received" is intended to check
whether the target will accept the drop. What we want is the "drag-drop"
signal which tells the widget that something was dropped on it.

Also fix an embarrassing lack of NULL pointer checks in my string
comparisons...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 17:03:15 -07:00
Dirk Hohndel
f4d50ffa3b Clean up the drag and drop code and allow ripping off the Dive Profile
Linus had used some deprecated interfcase and didn't correctly untangle
the new window that he created (hiding it the window... very nifty).

I think I'm closer to the real solution with a data structure that keeps
track of the components of the new top level window that I need to be able
to untangle (and eventually, destroy) at the end.

The one error I also can't seem to get rid of is the
Clean up the drag and drop code and allow ripping of the Dive Profile

Gtk-CRITICAL **: IA__gtk_selection_data_set: assertion `length <= 0' failed

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 16:23:59 -07:00
Linus Torvalds
1d7f5a4de1 Add drag-n-drop support to be able to re-integrate the dive list
This is somewhat hacky, and there is clearly something I still don't
understand about gtk selections and drag-n-drop.  Dropping it back
works, but I get a nasty error when I do it:

   (subsurface:8512): Gtk-CRITICAL **: IA__gtk_selection_data_set: assertion `length <= 0' failed

even though I actually never set any selection at all directly.  So
there must be some internal gtk rule that I am violating, but I can't
see what it is.

I probably shouldn't commit it with a known ugly wart like that, but I
really have no clue.  Maybe somebody else can figure out what is up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-27 12:54:53 -07:00
Linus Torvalds
3ca194b346 Don't mark the divelist window transient
That also makes it always stay in front of the other window, which is
just annoying.  I only did it because I wanted to make sure it dies when
the main window does, but since we just kill the main loop when closing
either window, that just isn't an issue.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-27 11:38:31 -07:00
Linus Torvalds
30ee87be92 Merge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface
* 'otu-tracking-v2' of git://github.com/dirkhh/subsurface:
  Store options in gconf
  Add preference option to chose if SAC and/or OTU should be in divelist

Fix up trivial conflicts in gtk-gui.c (cleanup in gtk dialog wrt
gtk_dialog_get_content_area() having introduced a new 'vbox' widget)
2011-09-27 11:05:39 -07:00
Dirk Hohndel
f3134cbb89 Store options in gconf
While it's not the most elegant way to do this I opted to store the
options with "inverted polarity" - i.e., the options that are supposed to
default to "True" are stored inverted since gconf reports an unset option
(first time the user runs the program) as "False".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 10:47:28 -07:00
Linus Torvalds
7bbe44f46a Make the dive list start as a plain notebook page
I've been wondering how to make 'subsurface' work better on a small
screen (I used to travel with a crappy netbook - I may have upgraded my
laptop since, but it is still a design goal of mine to make sure it all
works fine in that kind of environment).

And ever since the dive list was made much wider and moved below the
notebook, it's annoyed me how much room it all takes if I want to have
both a reasonable plot window and several dives visible at the same
time.

The solution seems to be to just make the dive list be a notebook page.
That makes the default layout very dense.

At the same time, when you have the pixels, it's horrible, because you
would want to see the dive list and move between dives while at the same
time also seeing the dive profile change.  But that is solvable by
simply making the dive list notebook page be detachable, so if you have
a nice big screen, just detach the dive list page and now you have
independent windows for the dive list and the dive info.

NOTE! I don't have any way to re-attach the dang thing.  I think I'd
need to learn about drag-and-drop targets etc.  So once you've detached
the dive list, it stays detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-27 10:38:07 -07:00
Dirk Hohndel
0aad4d6094 Add preference option to chose if SAC and/or OTU should be in divelist
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-27 10:16:40 -07:00
Linus Torvalds
5c3bdd9fc8 Add the version to the Makefile
Not quite the same format as for the kernel, but I want to do the normal
"edit the makefile before making a release" model that I'm used to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-26 11:04:50 -07:00
Linus Torvalds
da47ee401d Add a GtkEntry to allow editing of the device name
Ok, so some file chooser widget with a popup dialog would have been more
professional, but I'm lazy.  Plus I suspect the popup would look
horrible when populated with /dev entries, and I don't think there is
any sane filter function.

So this works, and means that you don't *have* to recompile the whole
program just because you have your dive computer on something else than
a USB serial line.

I suspect I should save the default name as a config variable too.
Maybe a setting in the preferences dialog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-26 09:44:27 -07:00
Linus Torvalds
acca9b1804 Add a "Dive Computer" frame around the dive computer choice in import
I'll add a widget to allow the user to select the device too, so let's
name things to make them more obvious.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-26 09:19:30 -07:00
Linus Torvalds
c3a4844197 Add a xml file filter to the file open dialog
My home directory is a mess.  Don't show all the crap, just the stuff
that might be relevant.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-26 09:18:23 -07:00
Linus Torvalds
d81553e151 Add an 'About' dialog
It's really just about the logo, but whatever.  Dirk tells me I need one
of these in order to call it 1.0.  And I'm not going to fall into the
trap of thinking that 1.0 needs to be something polished, it just needs
to be working well enough..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-24 15:48:13 -07:00
Linus Torvalds
f12684dcd7 Use 'gtk_dialog_get_content_area()' instead of accessing dialog directly
I'm reading gtk docs, and trying to clean things up a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-24 15:26:37 -07:00
Linus Torvalds
c0adfdc41b Fix progress bar during libdivecomputer imports
As reported by Mauro Dreissig, the progress bar doesn't work and causes
a SIGSEGV due to a missing allocation.  The code broke when Dirk
separated out the GUI from the core code, and I hadn't tried
divecomputer downloads since.

Reported-by: Mauro Dreissig <mukadr@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 16:38:24 -07:00
Dirk Hohndel
a817f4b547 Use the last (or only) filename on command line as default for saving
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:35:20 -07:00
Dirk Hohndel
8a8ad3f997 Show the "save changes" dialog before the main window is destroyed
By using the delete-event callback instead of the destroy callback we are
able to display our dialog (and the file-save dialog) while the program
window is still being displayed. Much nicer this way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
740e7119cd Check for changes at regular 'quit' events as well
Also make the dialog box less offensively ugly

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
7a8fe91690 Catch changes to the info of the current dive when quitting
As the application shuts down we do one more check to see if the dive that
is currently being displayed has been modified (we previously just checked
as we switch dives)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
f459c2ec22 Simplistic first attempt to get changes saved when quitting subsurface
Track whether things changed in the global dive_list

So far this actually works if changing dive info (but only if dive
selected was changed after the dive info was changed).

We are not tracking changes to the cylinder information, yet.

also remove the duplicate static dive_list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:28:36 -07:00
Linus Torvalds
0bf2cfa66d Fix preferences dialog
Dirk took some old code when he did the merge of the newly split gui
code. Fix it up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20 14:05:46 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 12:48:56 -07:00