config.py

changeset 30
3dd525652dc8
parent 23
86b42610d5a8
child 31
b4b4bb7a2ec5
--- a/config.py	Sun Jan 21 12:04:24 2018 +0000
+++ b/config.py	Sun Jan 21 12:10:57 2018 +0000
@@ -22,7 +22,10 @@
     # Default: retry every 15 minutes if unable to connect / unfinished backup
     'retry_interval': 900,
     # Extract passphrases at startup or on demand?
-    '__extract_passphrases_at_startup': True,
+    'extract_passphrases_at_startup': True,
+    # Do not insert a quit menu entry (useful for installing on computers of
+    # inexperienced users)
+    'no_quit_menu_entry': False,
     # Borg settings
     'borg': {
         'executable': 'borg',
@@ -40,6 +43,10 @@
 def error(x):
     raise AssertionError(x)
 
+def check_bool(cfg, field, descr, loc, default=None):
+    return check_field(cfg, field, descr, loc, default,
+                       lambda x: isinstance(x, bool))
+
 def check_string(cfg, field, descr, loc, default=None):
     return check_field(cfg, field, descr, loc, default,
                        lambda x: isinstance(x, str))
@@ -139,7 +146,8 @@
 
 check_and_set(settings, 'backup_interval', 'top-level', defaults, check_nonneg_int)
 check_and_set(settings, 'retry_interval', 'top-level', defaults, check_nonneg_int)
-check_and_set(settings, '__extract_passphrases_at_startup', 'top-level', defaults, check_nonneg_int)
+check_and_set(settings, 'extract_passphrases_at_startup', 'top-level', defaults, check_nonneg_int)
+check_and_set(settings, 'no_quit_menu_entry', 'top-level', defaults, check_bool)
 check_and_set(settings, 'borg', 'top-level', defaults, check_dict)
 # Check parameters within 'borg'
 if True:

mercurial