]> 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 b5c2066e345678fa36f189116c2d6b243eccf60e..e733e92976ade780c9694d2dc088a84f5b464976 100644 (file)
@@ -104,6 +104,7 @@ static const char search_config_comment[] =
 struct _notmuch_config {
     char *filename;
     GKeyFile *key_file;
 struct _notmuch_config {
     char *filename;
     GKeyFile *key_file;
+    notmuch_bool_t is_new;
 
     char *database_path;
     char *user_name;
 
     char *database_path;
     char *user_name;
@@ -266,6 +267,7 @@ notmuch_config_open (void *ctx,
 
     config->key_file = g_key_file_new ();
 
 
     config->key_file = g_key_file_new ();
 
+    config->is_new = FALSE;
     config->database_path = NULL;
     config->user_name = NULL;
     config->user_primary_email = NULL;
     config->database_path = NULL;
     config->user_name = NULL;
     config->user_primary_email = NULL;
@@ -435,6 +437,8 @@ notmuch_config_open (void *ctx,
     if (is_new_ret)
        *is_new_ret = is_new;
 
     if (is_new_ret)
        *is_new_ret = is_new;
 
+    config->is_new = is_new;
+
     return config;
 }
 
     return config;
 }
 
@@ -482,6 +486,13 @@ notmuch_config_save (notmuch_config_t *config)
     return 0;
 }
 
     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,
 static const char **
 _config_get_list (notmuch_config_t *config,
                  const char *section, const char *key,