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
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
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
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
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
59 * notmuch_tags_move_to_prevoius do the opposite than
\r
60 notmuch_tags_move_to_next, getting the tags iterator one
\r
63 * notmuch_tags_move_to_last move the iterator to the first last tag.
\r
65 * notmuch_tags_move_to_first move the iterator to the first valid tag.
\r
67 lib/notmuch.h | 28 ++++++++++++++++++++++++++++
\r
68 lib/tags.c | 21 +++++++++++++++++++++
\r
69 2 files changed, 49 insertions(+), 0 deletions(-)
\r
71 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
72 index b96b624..dc668dc 100644
\r
75 @@ -1022,6 +1022,15 @@ notmuch_tags_valid (notmuch_tags_t *tags);
\r
77 notmuch_tags_get (notmuch_tags_t *tags);
\r
79 +/* Move the 'tags' iterator to the first tag.
\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
86 +notmuch_tags_move_to_first (notmuch_tags_t *tags);
\r
88 /* Move the 'tags' iterator to the next tag.
\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
93 notmuch_tags_move_to_next (notmuch_tags_t *tags);
\r
95 +/* Move the 'tags' iterator to the last tag.
\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
102 +notmuch_tags_move_to_last (notmuch_tags_t *tags);
\r
104 +/* Move the 'tags' iterator to the previous tag.
\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
112 +notmuch_tags_move_to_previous (notmuch_tags_t *tags);
\r
114 /* Destroy a notmuch_tags_t object.
\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
121 @@ -105,6 +105,12 @@ notmuch_tags_get (notmuch_tags_t *tags)
\r
125 +notmuch_tags_move_to_first (notmuch_tags_t *tags)
\r
127 + tags->iterator = g_list_first (tags->tags);
\r
131 notmuch_tags_move_to_next (notmuch_tags_t *tags)
\r
133 if (tags->iterator == NULL)
\r
134 @@ -114,6 +120,21 @@ notmuch_tags_move_to_next (notmuch_tags_t *tags)
\r
138 +notmuch_tags_move_to_last (notmuch_tags_t *tags)
\r
140 + tags->iterator = g_list_last (tags->tags);
\r
144 +notmuch_tags_move_to_previous (notmuch_tags_t *tags)
\r
146 + if (tags->iterator == NULL)
\r
149 + tags->iterator = tags->iterator->prev;
\r
153 notmuch_tags_destroy (notmuch_tags_t *tags)
\r
155 talloc_free (tags);
\r