]> granicus.if.org Git - neomutt/blob - progress.h
Fix mutt_write_mime_body() application/pgp-encrypted handling
[neomutt] / progress.h
1 /**
2  * @file
3  * Progress bar
4  *
5  * @authors
6  * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
7  * Copyright (C) 2019 Pietro Cerutti <gahr@gahr.ch>
8  *
9  * @copyright
10  * This program is free software: you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation, either version 2 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program.  If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #ifndef MUTT_PROGRESS_H
25 #define MUTT_PROGRESS_H
26
27 #include <stdbool.h>
28 #include <stdio.h>
29
30 /* These Config Variables are only used in progress.c */
31 extern short C_TimeInc;
32 extern short C_ReadInc;
33 extern short C_WriteInc;
34 extern short C_NetInc;
35
36 /**
37  * Enum ProgressType - What kind of operation is this progress tracking?
38  */
39 enum ProgressType
40 {
41   MUTT_PROGRESS_READ,  ///< Progress tracks elements, according to C_ReadInc
42   MUTT_PROGRESS_WRITE, ///< Progress tracks elements, according to C_WriteInc
43   MUTT_PROGRESS_NET    ///< Progress tracks bytes, according to C_NetInc
44 };
45
46 /**
47  * struct Progress - A progress bar
48  */
49 struct Progress
50 {
51   char msg[1024];
52   char sizestr[24];
53   size_t pos;
54   size_t size;
55   size_t inc;
56   long timestamp;
57   bool is_bytes;
58 };
59
60 void mutt_progress_init(struct Progress *progress, const char *msg, enum ProgressType type, size_t size);
61 void mutt_progress_update(struct Progress *progress, size_t pos, int percent);
62
63 #endif /* MUTT_PROGRESS_H */