]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-config.c
cli: config: keep track of whether the config is newly created
[notmuch] / notmuch-config.c
index 3e37a2d654b5c57df4d3a39d07afe97b5e9095e6..e733e92976ade780c9694d2dc088a84f5b464976 100644 (file)
@@ -49,8 +49,9 @@ static const char new_config_comment[] =
     "\tignore  A list (separated by ';') of file and directory names\n"
     "\t        that will not be searched for messages by \"notmuch new\".\n"
     "\n"
-    "\t        NOTE: *Every* file/directory that goes by one of those names will\n"
-    "\t        be ignored, independent of its depth/location in the mail store.\n";
+    "\t        NOTE: *Every* file/directory that goes by one of those\n"
+    "\t        names will be ignored, independent of its depth/location\n"
+    "\t        in the mail store.\n";
 
 static const char user_config_comment[] =
     " User configuration\n"
@@ -103,6 +104,7 @@ static const char search_config_comment[] =
 struct _notmuch_config {
     char *filename;
     GKeyFile *key_file;
+    notmuch_bool_t is_new;
 
     char *database_path;
     char *user_name;
@@ -265,6 +267,7 @@ notmuch_config_open (void *ctx,
 
     config->key_file = g_key_file_new ();
 
+    config->is_new = FALSE;
     config->database_path = NULL;
     config->user_name = NULL;
     config->user_primary_email = NULL;
@@ -434,6 +437,8 @@ notmuch_config_open (void *ctx,
     if (is_new_ret)
        *is_new_ret = is_new;
 
+    config->is_new = is_new;
+
     return config;
 }
 
@@ -481,6 +486,13 @@ notmuch_config_save (notmuch_config_t *config)
     return 0;
 }
 
+notmuch_bool_t
+notmuch_config_is_new (notmuch_config_t *config)
+{
+    return config->is_new;
+}
+
+
 static const char **
 _config_get_list (notmuch_config_t *config,
                  const char *section, const char *key,