1N/A/*
1N/A libparted - a library for manipulating disk partitions
1N/A Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation,
1N/A Inc.
1N/A
1N/A This program is free software; you can redistribute it and/or modify
1N/A it under the terms of the GNU General Public License as published by
1N/A the Free Software Foundation; either version 3 of the License, or
1N/A (at your option) any later version.
1N/A
1N/A This program is distributed in the hope that it will be useful,
1N/A but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A GNU General Public License for more details.
1N/A
1N/A You should have received a copy of the GNU General Public License
1N/A along with this program. If not, see <http://www.gnu.org/licenses/>.
1N/A*/
1N/A
1N/A/**
1N/A * \addtogroup PedTimer
1N/A * @{
1N/A */
1N/A
1N/A/** \file timer.h */
1N/A
1N/A#ifndef PED_TIMER_H_INCLUDED
1N/A#define PED_TIMER_H_INCLUDED
1N/A
1N/A#include <time.h>
1N/A
1N/Atypedef struct _PedTimer PedTimer;
1N/A
1N/Atypedef void PedTimerHandler (PedTimer* timer, void* context);
1N/A
1N/A/*
1N/A * Structure keeping track of progress and time
1N/A */
1N/Astruct _PedTimer {
1N/A float frac; /**< fraction of operation done */
1N/A time_t start; /**< time of start of op */
1N/A time_t now; /**< time of last update (now!) */
1N/A time_t predicted_end; /**< expected finish time */
1N/A const char* state_name; /**< eg: "copying data" */
1N/A PedTimerHandler* handler; /**< who to notify on updates */
1N/A void* context; /**< context to pass to handler */
1N/A};
1N/A
1N/Aextern PedTimer* ped_timer_new (PedTimerHandler* handler, void* context);
1N/Aextern void ped_timer_destroy (PedTimer* timer);
1N/A
1N/A/* a nested timer automatically notifies it's parent. You should only
1N/A * create one when you are going to use it (not before)
1N/A */
1N/Aextern PedTimer* ped_timer_new_nested (PedTimer* parent, float nest_frac);
1N/Aextern void ped_timer_destroy_nested (PedTimer* timer);
1N/A
1N/Aextern void ped_timer_touch (PedTimer* timer);
1N/Aextern void ped_timer_reset (PedTimer* timer);
1N/Aextern void ped_timer_update (PedTimer* timer, float new_frac);
1N/Aextern void ped_timer_set_state_name (PedTimer* timer, const char* state_name);
1N/A
1N/A#endif /* PED_TIMER_H_INCLUDED */
1N/A
1N/A
1N/A/** @} */