2
libparted - a library for manipulating disk partitions
3
Copyright (C) 2001-2002, 2007, 2009-2012 Free Software Foundation, Inc.
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 3 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program. If not, see <http://www.gnu.org/licenses/>.
20
* \addtogroup PedTimer
26
#ifndef PED_TIMER_H_INCLUDED
27
#define PED_TIMER_H_INCLUDED
31
typedef struct _PedTimer PedTimer;
33
typedef void PedTimerHandler (PedTimer* timer, void* context);
36
* Structure keeping track of progress and time
39
float frac; /**< fraction of operation done */
40
time_t start; /**< time of start of op */
41
time_t now; /**< time of last update (now!) */
42
time_t predicted_end; /**< expected finish time */
43
const char* state_name; /**< eg: "copying data" */
44
PedTimerHandler* handler; /**< who to notify on updates */
45
void* context; /**< context to pass to handler */
48
extern PedTimer* ped_timer_new (PedTimerHandler* handler, void* context);
49
extern void ped_timer_destroy (PedTimer* timer);
51
/* a nested timer automatically notifies it's parent. You should only
52
* create one when you are going to use it (not before)
54
extern PedTimer* ped_timer_new_nested (PedTimer* parent, float nest_frac);
55
extern void ped_timer_destroy_nested (PedTimer* timer);
57
extern void ped_timer_touch (PedTimer* timer);
58
extern void ped_timer_reset (PedTimer* timer);
59
extern void ped_timer_update (PedTimer* timer, float new_frac);
60
extern void ped_timer_set_state_name (PedTimer* timer, const char* state_name);
62
#endif /* PED_TIMER_H_INCLUDED */