X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-config.c;h=e9456d794456c080e81abbd6a00efcb6b123c3c4;hp=11d8d68b5b5ead71d24d9f37202eaf958e8b1ccd;hb=HEAD;hpb=22e04ed01acc115b7fb25b60231014f585f11c4a diff --git a/notmuch-config.c b/notmuch-config.c index 11d8d68b..f7e59f1e 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -40,11 +40,13 @@ static const struct config_group { "database", " Database configuration\n" "\n" - " The only value supported here is 'path' which should be the top-level\n" - " directory where your mail currently exists and to where mail will be\n" - " delivered in the future. Files should be individual email messages.\n" - " Notmuch will store its database within a sub-directory of the path\n" - " configured here named \".notmuch\".\n" + " Supported values are 'mail_root' and 'path'. The recommended option\n" + " is to set 'mail_root' to the directory where your mail currently exists\n" + " and to where mail will be delivered in the future. Files should be\n" + " individual email messages. By default notmuch will store its database\n" + " in $XDG_DATA_HOME/notmuch; you can override this by setting 'path'.\n" + " If only 'path' is set, this directory is for 'mail_root' and for\n" + " the database location (in a subdirectory called \".notmuch\").\n" }, { "user", @@ -278,18 +280,24 @@ notmuch_conffile_open (notmuch_database_t *notmuch, return NULL; } - if (config->is_new) - g_key_file_set_comment (config->key_file, NULL, NULL, - toplevel_config_comment, NULL); - for (size_t i = 0; i < ARRAY_SIZE (group_comment_table); i++) { const char *name = group_comment_table[i].group_name; if (! g_key_file_has_group (config->key_file, name)) { /* Force group to exist before adding comment */ g_key_file_set_value (config->key_file, name, "dummy_key", "dummy_val"); g_key_file_remove_key (config->key_file, name, "dummy_key", NULL); - g_key_file_set_comment (config->key_file, name, NULL, - group_comment_table[i].comment, NULL); + if (config->is_new && (i == 0) ) { + const char *comment; + + comment = talloc_asprintf (config, "%s\n%s", + toplevel_config_comment, + group_comment_table[i].comment); + g_key_file_set_comment (config->key_file, name, NULL, comment, + NULL); + } else { + g_key_file_set_comment (config->key_file, name, NULL, + group_comment_table[i].comment, NULL); + } } } return config; @@ -383,7 +391,10 @@ _config_set_list (notmuch_conffile_t *config, const char *list[], size_t length) { - g_key_file_set_string_list (config->key_file, group, key, list, length); + if (length > 1) + g_key_file_set_string_list (config->key_file, group, key, list, length); + else + g_key_file_set_string (config->key_file, group, key, list[0]); } void