aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 20:03:06 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 20:05:21 +0200
commit46d260a4381f88d4ac8b2dc17179db8beaee5718 (patch)
tree88ff173f79f7bb84545273f315b48a0b14322a3f /src/io.c
parentb36d253dce737a188bff85891fc5b4c4341f6564 (diff)
downloadcalcurse-46d260a4381f88d4ac8b2dc17179db8beaee5718.tar.gz
calcurse-46d260a4381f88d4ac8b2dc17179db8beaee5718.zip
Warn when reloading with unsaved modifications
Since the reload operation overwrites all changes, warn before reloading if there are unsaved modifications. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index 4ff31e3..acf624b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -83,6 +83,8 @@ HTABLE_PROTOTYPE(ht_keybindings, ht_keybindings_s)
HTABLE_GENERATE(ht_keybindings, ht_keybindings_s, load_keys_ht_getkey,
load_keys_ht_compare)
+static int modified = 0;
+
/* Draw a progress bar while saving, loading or exporting data. */
static void progress_bar(progress_bar_t type, int progress)
{
@@ -430,6 +432,8 @@ void io_save_cal(enum save_display display)
if (!io_save_keys())
ERROR_MSG("%s", access_pb);
+ io_unset_modified();
+
/* Print a message telling data were saved */
if (ui_mode == UI_CURSES && conf.system_dialogs) {
status_mesg(save_success, enter);
@@ -1342,3 +1346,18 @@ int io_file_cp(const char *src, const char *dst)
return 1;
}
+
+void io_unset_modified(void)
+{
+ modified = 0;
+}
+
+void io_set_modified(void)
+{
+ modified = 1;
+}
+
+int io_get_modified(void)
+{
+ return modified;
+}