[PATCH 1/9] lib: read "property" terms from messages.
[notmuch-archives.git] / 3e / f3932d30a88c32a193477c480d42d564097525
1 Return-Path: <meskio@sindominio.net>\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 E93D6417341\r
6         for <notmuch@notmuchmail.org>; Sat, 20 Mar 2010 03:22:14 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.001\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5\r
12         tests=[BAYES_20=-0.001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id LOtAKEXQMmDW for <notmuch@notmuchmail.org>;\r
16         Sat, 20 Mar 2010 03:22:14 -0700 (PDT)\r
17 Received: from flatline.sindominio.net (flatline.sindominio.net [82.144.4.26])\r
18         by olra.theworths.org (Postfix) with ESMTP id 12C4941733B\r
19         for <notmuch@notmuchmail.org>; Sat, 20 Mar 2010 03:22:14 -0700 (PDT)\r
20 Received: from localhost (localhost.localdomain [127.0.0.1])\r
21         by flatline.sindominio.net (Postfix) with ESMTP id 5910A26282B;\r
22         Sat, 20 Mar 2010 11:22:13 +0100 (CET)\r
23 X-Virus-Scanned: Debian amavisd-new at sindominio.net\r
24 Received: from flatline.sindominio.net ([127.0.0.1])\r
25         by localhost (flatline.sindominio.net [127.0.0.1]) (amavisd-new,\r
26         port 10024)\r
27         with ESMTP id Bs3P71CXzcgQ; Sat, 20 Mar 2010 11:22:10 +0100 (CET)\r
28 Received: from blackspot (heal.cauterized.net [89.140.131.167])\r
29         by flatline.sindominio.net (Postfix) with ESMTPA id 926F1262E3D;\r
30         Sat, 20 Mar 2010 11:21:52 +0100 (CET)\r
31 Received: by blackspot (Postfix, from userid 1000)\r
32         id 8BB608BE00; Sat, 20 Mar 2010 11:24:55 +0100 (CET)\r
33 From: Ruben Pollan <meskio@sindominio.net>\r
34 To: notmuch@notmuchmail.org\r
35 Date: Sat, 20 Mar 2010 11:23:25 +0100\r
36 Message-Id: <1269080605-5617-6-git-send-email-meskio@sindominio.net>\r
37 X-Mailer: git-send-email 1.7.0\r
38 In-Reply-To: <873a09jt2t.fsf@yoom.home.cworth.org>\r
39 References: <873a09jt2t.fsf@yoom.home.cworth.org>\r
40 Subject: [notmuch] [PATCH 5/5] Added backwards iterator to tags\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Sat, 20 Mar 2010 10:22:15 -0000\r
54 \r
55 Added the functions notmuch_tags_move_to_prevoius,\r
56 notmuch_tags_move_to_last and  notmuch_tags_move_to_first to notmuch\r
57 library. With them is possible to iterate backwards on tags.\r
58 \r
59 * notmuch_tags_move_to_prevoius do the opposite than\r
60   notmuch_tags_move_to_next, getting the tags iterator one\r
61   position backwards.\r
62 \r
63 * notmuch_tags_move_to_last move the iterator to the first last tag.\r
64 \r
65 * notmuch_tags_move_to_first move the iterator to the first valid tag.\r
66 ---\r
67  lib/notmuch.h |   28 ++++++++++++++++++++++++++++\r
68  lib/tags.c    |   21 +++++++++++++++++++++\r
69  2 files changed, 49 insertions(+), 0 deletions(-)\r
70 \r
71 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
72 index b96b624..dc668dc 100644\r
73 --- a/lib/notmuch.h\r
74 +++ b/lib/notmuch.h\r
75 @@ -1022,6 +1022,15 @@ notmuch_tags_valid (notmuch_tags_t *tags);\r
76  const char *\r
77  notmuch_tags_get (notmuch_tags_t *tags);\r
78  \r
79 +/* Move the 'tags' iterator to the first tag.\r
80 + *\r
81 + * After that the 'tags' iterator will be set to the first valid \r
82 + * tag, so it can be use to iterate with \r
83 + * notmuch_tags_move_to_next.\r
84 + */\r
85 +void\r
86 +notmuch_tags_move_to_first (notmuch_tags_t *tags);\r
87 +\r
88  /* Move the 'tags' iterator to the next tag.\r
89   *\r
90   * If 'tags' is already pointing at the last tag then the iterator\r
91 @@ -1035,6 +1044,25 @@ notmuch_tags_get (notmuch_tags_t *tags);\r
92  void\r
93  notmuch_tags_move_to_next (notmuch_tags_t *tags);\r
94  \r
95 +/* Move the 'tags' iterator to the last tag.\r
96 + *\r
97 + * After that the 'tags' iterator will be set to the last valid \r
98 + * tag, so it can be use to iterate with \r
99 + * notmuch_tags_move_to_previous.\r
100 + */\r
101 +void\r
102 +notmuch_tags_move_to_last (notmuch_tags_t *tags);\r
103 +\r
104 +/* Move the 'tags' iterator to the previous tag.\r
105 + *\r
106 + * If 'tags' is already pointing at the first tag then the\r
107 + * iterator will be moved to a point just beyond that first tag,\r
108 + * (where notmuch_tags_valid will return FALSE and\r
109 + * notmuch_tags_get will return NULL).\r
110 + */\r
111 +void\r
112 +notmuch_tags_move_to_previous (notmuch_tags_t *tags);\r
113 +\r
114  /* Destroy a notmuch_tags_t object.\r
115   *\r
116   * It's not strictly necessary to call this function. All memory from\r
117 diff --git a/lib/tags.c b/lib/tags.c\r
118 index 8fe4a3f..9c9a897 100644\r
119 --- a/lib/tags.c\r
120 +++ b/lib/tags.c\r
121 @@ -105,6 +105,12 @@ notmuch_tags_get (notmuch_tags_t *tags)\r
122  }\r
123  \r
124  void\r
125 +notmuch_tags_move_to_first (notmuch_tags_t *tags)\r
126 +{\r
127 +    tags->iterator = g_list_first (tags->tags);\r
128 +}\r
129 +\r
130 +void\r
131  notmuch_tags_move_to_next (notmuch_tags_t *tags)\r
132  {\r
133      if (tags->iterator == NULL)\r
134 @@ -114,6 +120,21 @@ notmuch_tags_move_to_next (notmuch_tags_t *tags)\r
135  }\r
136  \r
137  void\r
138 +notmuch_tags_move_to_last (notmuch_tags_t *tags)\r
139 +{\r
140 +    tags->iterator = g_list_last (tags->tags);\r
141 +}\r
142 +\r
143 +void\r
144 +notmuch_tags_move_to_previous (notmuch_tags_t *tags)\r
145 +{\r
146 +    if (tags->iterator == NULL)\r
147 +       return;\r
148 +\r
149 +    tags->iterator = tags->iterator->prev;\r
150 +}\r
151 +\r
152 +void\r
153  notmuch_tags_destroy (notmuch_tags_t *tags)\r
154  {\r
155      talloc_free (tags);\r
156 -- \r
157 1.7.0\r
158 \r