Progress Bar. More...
#include <stdbool.h>
#include <stdio.h>
Go to the source code of this file.
Enumerations | |
enum | ProgressType { MUTT_PROGRESS_NET , MUTT_PROGRESS_READ , MUTT_PROGRESS_WRITE } |
What kind of operation is this progress tracking? More... | |
Functions | |
void | progress_free (struct Progress **ptr) |
Free a Progress Bar. | |
struct Progress * | progress_new (enum ProgressType type, size_t size) |
Create a new Progress Bar. | |
bool | progress_update (struct Progress *progress, size_t pos, int percent) |
Update the state of the progress bar. | |
void | progress_set_message (struct Progress *progress, const char *fmt,...) __attribute__((__format__(__printf__ |
void void | progress_set_size (struct Progress *progress, size_t size) |
Set the progress size. | |
Progress Bar.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file lib.h.
enum ProgressType |
What kind of operation is this progress tracking?
void progress_free | ( | struct Progress ** | ptr | ) |
Free a Progress Bar.
ptr | Progress Bar to free |
Definition at line 110 of file progress.c.
struct Progress * progress_new | ( | enum ProgressType | type, |
size_t | size | ||
) |
Create a new Progress Bar.
type | Type, e.g. MUTT_PROGRESS_READ |
size | Total size of expected file / traffic |
ptr | New Progress Bar |
If the user has disabled the progress bar, e.g. set read_inc = 0
then a simple message will be displayed instead.
Definition at line 139 of file progress.c.
bool progress_update | ( | struct Progress * | progress, |
size_t | pos, | ||
int | percent | ||
) |
Update the state of the progress bar.
progress | Progress bar |
pos | Position, or count |
percent | Percentage complete |
true | Screen update is needed |
If percent is -1, then the percentage will be calculated using pos and the size in progress.
If percent is positive, it is displayed as percentage, otherwise percentage is calculated from size and pos if progress was initialized with positive size, otherwise no percentage is shown
Definition at line 80 of file progress.c.
void progress_set_message | ( | struct Progress * | progress, |
const char * | fmt, | ||
... | |||
) |
void void progress_set_size | ( | struct Progress * | progress, |
size_t | size | ||
) |
Set the progress size.
Definition at line 190 of file progress.c.