summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-21 12:28:20 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-21 12:28:20 -0700
commitd94fb7ca6b4fc17dacd069522d7fad00aa69e088 (patch)
tree06afae13d3b894aa835b78af88d270aabd2c4c5f /divelist.c
parent51486040686592965bd7a70cf52767350cfde5f6 (diff)
parenta817f4b547b4193d31154fd0ff7f5190ccae76a5 (diff)
downloadsubsurface-d94fb7ca6b4fc17dacd069522d7fad00aa69e088.tar.gz
Merge branch 'quit-handling' of git://github.com/dirkhh/subsurface
* 'quit-handling' of git://github.com/dirkhh/subsurface: Use the last (or only) filename on command line as default for saving Show the "save changes" dialog before the main window is destroyed Check for changes at regular 'quit' events as well Catch changes to the info of the current dive when quitting Tracking changes to tanks is trivial Simplistic first attempt to get changes saved when quitting subsurface
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c18
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;
+}