diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2011-09-20 21:29:09 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2011-09-21 11:28:36 -0700 |
commit | f459c2ec22839a4a208ea833bdb1e0b87a6799b4 (patch) | |
tree | 88c9a0b217c6e6e1975b91bd421845ccd31c2830 /divelist.c | |
parent | b4c4a29a11ff82dacfe3a145fe4eedaae2341151 (diff) | |
download | subsurface-f459c2ec22839a4a208ea833bdb1e0b87a6799b4.tar.gz |
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>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c index 88825dd89..e84e3a10d 100644 --- a/divelist.c +++ b/divelist.c @@ -7,6 +7,8 @@ * void dive_list_update_dives(void) * void update_dive_list_units(void) * void set_divelist_font(const char *font) + * void mark_divelist_changed(int changed) + * int unsaved_changes() */ #include <stdio.h> #include <stdlib.h> @@ -24,6 +26,7 @@ struct DiveList { GtkListStore *model; GtkTreeViewColumn *date, *depth, *duration, *location; GtkTreeViewColumn *temperature, *cylinder, *nitrox, *sac; + int changed; }; static struct DiveList dive_list; @@ -45,9 +48,6 @@ enum { DIVELIST_COLUMNS }; -/* the global dive list that we maintain */ -static struct DiveList dive_list; - static void selection_cb(GtkTreeSelection *selection, GtkTreeModel *model) { GtkTreeIter iter; @@ -492,5 +492,17 @@ GtkWidget *dive_list_create(void) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(dive_list.container_widget), dive_list.tree_view); + dive_list.changed = 0; + return dive_list.container_widget; } + +void mark_divelist_changed(int changed) +{ + dive_list.changed = changed; +} + +int unsaved_changes() +{ + return dive_list.changed; +} |