diff options
author | Jani Nikula <jani@nikula.org> | 2013-03-03 23:55:07 +0200 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2013-03-07 09:39:05 -0400 |
commit | ca3a4fc02287f65c3587908012d36e68df0200b1 (patch) | |
tree | 1c4010b80d8f4906c868f3035d72e1e40b47b741 /notmuch-config.c | |
parent | e9cffd93458ce48c4e653b5694e872b7bbc2ca00 (diff) |
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().
Diffstat (limited to 'notmuch-config.c')
-rw-r--r-- | notmuch-config.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/notmuch-config.c b/notmuch-config.c index b5c2066e..e733e929 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -104,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; @@ -266,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; @@ -435,6 +437,8 @@ notmuch_config_open (void *ctx, if (is_new_ret) *is_new_ret = is_new; + config->is_new = is_new; + return config; } @@ -482,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, |