From 989b6c885f06f887cb8dafcd69059c376988d938 Mon Sep 17 00:00:00 2001
From: Frederic Culot <calcurse@culot.org>
Date: Sat, 1 Aug 2009 17:44:51 +0000
Subject: Save and restore daemon configuration options.

---
 src/custom.c | 18 +++++++++++++++---
 src/custom.h |  6 ++++--
 src/io.c     | 15 +++++++++++++--
 3 files changed, 32 insertions(+), 7 deletions(-)

(limited to 'src')

diff --git a/src/custom.c b/src/custom.c
index 679d914..a6a92d7 100755
--- a/src/custom.c
+++ b/src/custom.c
@@ -1,4 +1,4 @@
-/*	$calcurse: custom.c,v 1.42 2009/07/29 18:20:54 culot Exp $	*/
+/*	$calcurse: custom.c,v 1.43 2009/08/01 17:44:51 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -319,6 +319,14 @@ custom_load_conf (conf_t *conf, int background)
 	    conf->input_datefmt = 1;
 	  var = 0;
 	  break;
+	case CUSTOM_CONF_DMON_ENABLE:
+	  dmon.enable = fill_config_var (e_conf);
+	  var = 0;
+	  break;
+	case CUSTOM_CONF_DMON_LOG:
+	  dmon.log = fill_config_var (e_conf);
+	  var = 0;
+	  break;
 	default:
           EXIT (_("configuration variable unknown"));
 	  /* NOTREACHED */
@@ -352,10 +360,14 @@ custom_load_conf (conf_t *conf, int background)
 	var = CUSTOM_CONF_NOTIFYBARWARNING;
       else if (strncmp (e_conf, "notify-bar_command=", 19) == 0)
 	var = CUSTOM_CONF_NOTIFYBARCOMMAND;
-      else if (strncmp (e_conf, "output_datefmt=", 12) == 0)
+      else if (strncmp (e_conf, "output_datefmt=", 15) == 0)
 	var = CUSTOM_CONF_OUTPUTDATEFMT;
-      else if (strncmp (e_conf, "input_datefmt=", 12) == 0)
+      else if (strncmp (e_conf, "input_datefmt=", 14) == 0)
 	var = CUSTOM_CONF_INPUTDATEFMT;
+      else if (strncmp (e_conf, "notify-daemon_enable=", 21) == 0)
+        var = CUSTOM_CONF_DMON_ENABLE;
+      else if (strncmp (e_conf, "notify-daemon_log=", 18) == 0)
+        var = CUSTOM_CONF_DMON_LOG;
     }
   file_close (data_file, __FILE_POS__);
   pthread_mutex_unlock (&nbar.mutex);
diff --git a/src/custom.h b/src/custom.h
index a921c7b..317413a 100755
--- a/src/custom.h
+++ b/src/custom.h
@@ -1,9 +1,9 @@
-/*	$calcurse: custom.h,v 1.16 2009/07/05 20:33:18 culot Exp $	*/
+/*	$calcurse: custom.h,v 1.17 2009/08/01 17:44:51 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
  *
- * Copyright (c) 2004-2008 Frederic Culot <frederic@culot.org>
+ * Copyright (c) 2004-2009 Frederic Culot <frederic@culot.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -76,6 +76,8 @@ enum
   CUSTOM_CONF_NOTIFYBARCOMMAND,
   CUSTOM_CONF_OUTPUTDATEFMT,
   CUSTOM_CONF_INPUTDATEFMT,
+  CUSTOM_CONF_DMON_ENABLE,
+  CUSTOM_CONF_DMON_LOG,
   CUSTOM_CONF_VARIABLES
 };
 
diff --git a/src/io.c b/src/io.c
index 97b424d..eb14e19 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/*	$calcurse: io.c,v 1.76 2009/07/29 18:20:55 culot Exp $	*/
+/*	$calcurse: io.c,v 1.77 2009/08/01 17:44:52 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -940,7 +940,18 @@ io_save_conf (conf_t *conf)
   
   if (ui_mode == UI_CURSES)
     pthread_mutex_unlock (&nbar.mutex);
-  
+
+  (void)fprintf (fp, "\n# If this option is set to yes, "
+                 "calcurse will run in background to get notifications "
+                 "after exiting\n");
+  (void)fprintf (fp, "notify-daemon_enable=\n");
+  (void)fprintf (fp, "%s\n", dmon.enable ? "yes" : "no");
+
+    (void)fprintf (fp, "\n# If this option is set to yes, "
+                   "activity will be logged when running in background\n");
+  (void)fprintf (fp, "notify-daemon_log=\n");
+  (void)fprintf (fp, "%s\n", dmon.log ? "yes" : "no");
+    
   file_close (fp, __FILE_POS__);
 
   return 1;
-- 
cgit v1.2.3-70-g09d2