Fix CID 1491401 and 1491402: (possible) modulo by zero.
[claws.git] / src / common / progressindicator.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
4  *
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.
9  *
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.
14  *
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/>.
17  * 
18  */
19
20 #include <glib.h>
21
22 #include "hooks.h"
23 #include "progressindicator.h"
24
25 void progressindicator_start(ProgressType type)
26 {
27         ProgressData data;
28
29         data.cmd = PROGRESS_COMMAND_START;
30         data.type = type;
31
32         hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
33 }
34
35 void progressindicator_set_percentage(ProgressType type, gfloat percent)
36 {
37         ProgressData data;
38
39         data.cmd = PROGRESS_COMMAND_SET_PERCENTAGE;
40         data.type = type;
41         data.value = percent;
42
43         hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
44 }
45
46 void progressindicator_stop(ProgressType type)
47 {
48         ProgressData data;
49
50         data.cmd = PROGRESS_COMMAND_START;
51         data.type = type;
52
53         hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
54 }