mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
cli: config: keep track of whether the config is newly created
Keep track of whether the config is newly created, and add notmuch_config_is_new() accessor function to query this. This is to support anyone with a config handle to check this, instead of just whoever called notmuch_config_open().
This commit is contained in:
parent
e9cffd9345
commit
ca3a4fc022
2 changed files with 14 additions and 0 deletions
|
@ -256,6 +256,9 @@ notmuch_config_close (notmuch_config_t *config);
|
||||||
int
|
int
|
||||||
notmuch_config_save (notmuch_config_t *config);
|
notmuch_config_save (notmuch_config_t *config);
|
||||||
|
|
||||||
|
notmuch_bool_t
|
||||||
|
notmuch_config_is_new (notmuch_config_t *config);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
notmuch_config_get_database_path (notmuch_config_t *config);
|
notmuch_config_get_database_path (notmuch_config_t *config);
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ static const char search_config_comment[] =
|
||||||
struct _notmuch_config {
|
struct _notmuch_config {
|
||||||
char *filename;
|
char *filename;
|
||||||
GKeyFile *key_file;
|
GKeyFile *key_file;
|
||||||
|
notmuch_bool_t is_new;
|
||||||
|
|
||||||
char *database_path;
|
char *database_path;
|
||||||
char *user_name;
|
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->database_path = NULL;
|
||||||
config->user_name = NULL;
|
config->user_name = NULL;
|
||||||
config->user_primary_email = NULL;
|
config->user_primary_email = NULL;
|
||||||
|
@ -435,6 +437,8 @@ notmuch_config_open (void *ctx,
|
||||||
if (is_new_ret)
|
if (is_new_ret)
|
||||||
*is_new_ret = is_new;
|
*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 **
|
static const char **
|
||||||
_config_get_list (notmuch_config_t *config,
|
_config_get_list (notmuch_config_t *config,
|
||||||
const char *section, const char *key,
|
const char *section, const char *key,
|
||||||
|
|
Loading…
Reference in a new issue