From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 60471431FBF for ; Tue, 29 Jan 2013 13:46:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XnVhwrq2fJUc for ; Tue, 29 Jan 2013 13:46:39 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F08A1431FB6 for ; Tue, 29 Jan 2013 13:46:37 -0800 (PST) Received: by mail-lb0-f174.google.com with SMTP id l12so1340065lbo.33 for ; Tue, 29 Jan 2013 13:46:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=YLFzUaV58WrnYvtnhghc74bKBrMJQsRu4APYP5eJz8Y=; b=d0fxxYmNVtO3cO14/UtxL/x1A5lkgaDyegaOAqs+C5sYOHPKUwqaW2ezC8Zkwr5Bjk Rz1Elxf6Rj2IvgXglqg9G67xktOsT8kyVZl28b4AmtwDi3TUF50erFgY/h7sHwSPUyKb 43XHpXoOBBA+oBmEUZprp4LKoHJ3ZctGvvobDFgRCg1E15uOcpqq6IY1VqgIGC5TU7p9 IJsiMnCtx1QVcgcc6Vo2Vi1mYsEYagI4aNUo6DCeufozhJoyCE0hiJWnEHvcCN2iXGMz zya+NXjBsMl5MpzeSpcP1l9WA4/CqKRB3pjyDWSHRXFqxwVJIHDJ4mmNPg2udymV3dYE WhMA== X-Received: by 10.152.123.34 with SMTP id lx2mr2445055lab.52.1359495996396; Tue, 29 Jan 2013 13:46:36 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id j9sm5591267lbd.13.2013.01.29.13.46.33 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Jan 2013 13:46:35 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 1/6] cli: keep track of whether the config is newly created Date: Tue, 29 Jan 2013 23:46:19 +0200 Message-Id: <2f89028f7986f67792478f1728ca1f1fdd382d3c.1359495450.git.jani@nikula.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmU+inKmIRNoiBgIbnCDe6JsO9rJ9xgO+DRgDwVrGrPpJ0lDS5RVdizsZZF/Twf0+/mdwUR X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 21:46:40 -0000 Add notmuch_config_is_new() accessor function to check this. --- notmuch-client.h | 3 +++ notmuch-config.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/notmuch-client.h b/notmuch-client.h index 5f28836..07367e0 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -256,6 +256,9 @@ notmuch_config_close (notmuch_config_t *config); int notmuch_config_save (notmuch_config_t *config); +notmuch_bool_t +notmuch_config_is_new (notmuch_config_t *config); + const char * notmuch_config_get_database_path (notmuch_config_t *config); diff --git a/notmuch-config.c b/notmuch-config.c index b5c2066..e733e92 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, -- 1.7.10.4