1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 55641431FDE
\r
6 for <notmuch@notmuchmail.org>; Sun, 3 Mar 2013 13:55:34 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id wadRa9PmoXdI for <notmuch@notmuchmail.org>;
\r
17 Sun, 3 Mar 2013 13:55:33 -0800 (PST)
\r
18 Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com
\r
19 [209.85.217.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id C9865431E62
\r
22 for <notmuch@notmuchmail.org>; Sun, 3 Mar 2013 13:55:22 -0800 (PST)
\r
23 Received: by mail-lb0-f180.google.com with SMTP id q12so3500335lbc.11
\r
24 for <notmuch@notmuchmail.org>; Sun, 03 Mar 2013 13:55:21 -0800 (PST)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=google.com; s=20120113;
\r
27 h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to
\r
28 :references:in-reply-to:references:x-gm-message-state;
\r
29 bh=GbaZLqNuib6Un31BxcZvVhJmQJXcNymuaP73EOwI0fA=;
\r
30 b=EDLpd923COAOwexqQjM7YekH+37VS7u1D/4Jy7YFyd2nGAU1ks2cb2fAQSRRG4Usg4
\r
31 YbeloGP7+9SQCwwKXbu3Qg0tWT90M0WJNVePWzgB0DHEX1ntqQtmLgXHXYAmTrEjKN24
\r
32 W0UjQ7w+U5AWrMmrnQOMfmy7xvaBeTq48+0jheoVv4CLMu2UP4SsZvAXVpqXcB+3t9sk
\r
33 EYklm2qdHFecr2HTqkqQJ2ZN6paBVjfQBvsj3ZgdYKwPUGzic9W4SBE1mSKN/CEg9e4k
\r
34 flHkcgWwnPDI6fLFgE5KAqMTh4JqAPBEO8KEP85DXJAPNQSFmkbk3Rz7ajU+fzggtQFk
\r
36 X-Received: by 10.152.46.12 with SMTP id r12mr15878857lam.15.1362347721311;
\r
37 Sun, 03 Mar 2013 13:55:21 -0800 (PST)
\r
38 Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.
\r
40 by mx.google.com with ESMTPS id oy10sm10731246lab.8.2013.03.03.13.55.19
\r
41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
42 Sun, 03 Mar 2013 13:55:20 -0800 (PST)
\r
43 From: Jani Nikula <jani@nikula.org>
\r
44 To: notmuch@notmuchmail.org
\r
45 Subject: [PATCH v2 3/6] cli: config: keep track of whether the config is newly
\r
47 Date: Sun, 3 Mar 2013 23:55:07 +0200
\r
49 <1a1e9d8e37f178b8e1c9e41162366f6b9f326c99.1362347362.git.jani@nikula.org>
\r
50 X-Mailer: git-send-email 1.7.10.4
\r
51 In-Reply-To: <cover.1362347362.git.jani@nikula.org>
\r
52 References: <cover.1362347362.git.jani@nikula.org>
\r
53 In-Reply-To: <cover.1362347362.git.jani@nikula.org>
\r
54 References: <cover.1362347362.git.jani@nikula.org>
\r
56 ALoCoQmdfPAuHRwPJjpBZBChr9FVyHfvGsv9iOJF3ULYjBn84tjol02BhQE2s6HdbwcnYS7Ycb8M
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sun, 03 Mar 2013 21:55:34 -0000
\r
71 Keep track of whether the config is newly created, and add
\r
72 notmuch_config_is_new() accessor function to query this.
\r
74 This is to support anyone with a config handle to check this, instead
\r
75 of just whoever called notmuch_config_open().
\r
77 notmuch-client.h | 3 +++
\r
78 notmuch-config.c | 11 +++++++++++
\r
79 2 files changed, 14 insertions(+)
\r
81 diff --git a/notmuch-client.h b/notmuch-client.h
\r
82 index 5f28836..07367e0 100644
\r
83 --- a/notmuch-client.h
\r
84 +++ b/notmuch-client.h
\r
85 @@ -256,6 +256,9 @@ notmuch_config_close (notmuch_config_t *config);
\r
87 notmuch_config_save (notmuch_config_t *config);
\r
90 +notmuch_config_is_new (notmuch_config_t *config);
\r
93 notmuch_config_get_database_path (notmuch_config_t *config);
\r
95 diff --git a/notmuch-config.c b/notmuch-config.c
\r
96 index b5c2066..e733e92 100644
\r
97 --- a/notmuch-config.c
\r
98 +++ b/notmuch-config.c
\r
99 @@ -104,6 +104,7 @@ static const char search_config_comment[] =
\r
100 struct _notmuch_config {
\r
102 GKeyFile *key_file;
\r
103 + notmuch_bool_t is_new;
\r
105 char *database_path;
\r
107 @@ -266,6 +267,7 @@ notmuch_config_open (void *ctx,
\r
109 config->key_file = g_key_file_new ();
\r
111 + config->is_new = FALSE;
\r
112 config->database_path = NULL;
\r
113 config->user_name = NULL;
\r
114 config->user_primary_email = NULL;
\r
115 @@ -435,6 +437,8 @@ notmuch_config_open (void *ctx,
\r
117 *is_new_ret = is_new;
\r
119 + config->is_new = is_new;
\r
124 @@ -482,6 +486,13 @@ notmuch_config_save (notmuch_config_t *config)
\r
129 +notmuch_config_is_new (notmuch_config_t *config)
\r
131 + return config->is_new;
\r
135 static const char **
\r
136 _config_get_list (notmuch_config_t *config,
\r
137 const char *section, const char *key,
\r