Allow "capture info data" to not be a singleton.
[metze/wireshark/wip.git] / ui / progress_dlg.h
1 /* progress_dlg.h
2  * Definitions for progress dialog box routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __PROGRESS_DLG_H__
24 #define __PROGRESS_DLG_H__
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 /** @file
31  *  Progress (modal) dialog box routines.
32  *  @ingroup dialog_group
33  */
34
35 /** Progress dialog data. */
36 struct progdlg;
37
38 /** Progress dialog data. */
39 typedef struct progdlg progdlg_t;
40
41 /**
42  * Create and pop up the progress dialog. Allocates a "progdlg_t"
43  * and initialize it to contain all information the implementation
44  * needs in order to manipulate the dialog, and return a pointer to
45  * it.
46  *
47  * @param top_level_window UI widget to associate with the progress dialog, e.g.
48  *   the main window.
49  * @param task_title The task to do, e.g. "Loading"
50  * @param item_title The item to do, e.g. "capture.cap"
51  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
52  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
53  *   anything already done), FALSE if it can
54  * @param stop_flag A pointer to a Boolean variable that will be
55  *   set to TRUE if the user hits that button
56  * @return The newly created progress dialog
57  */
58 progdlg_t *create_progress_dlg(const gpointer top_level_window, const gchar *task_title, const gchar *item_title,
59     gboolean terminate_is_stop, gboolean *stop_flag);
60
61 /**
62  * Create a progress dialog, but only if it's not likely to disappear
63  * immediately. This can be disconcerting for the user.
64  *
65  * @param top_level_window The top-level window associated with the progress update.
66  *   May be NULL.
67  * @param task_title The task to do, e.g. "Loading"
68  * @param item_title The item to do, e.g. "capture.cap"
69  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
70  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
71  *   anything already done), FALSE if it can
72  * @param stop_flag A pointer to a Boolean variable that will be
73  *   set to TRUE if the user hits that button
74  * @param start_time A pointer to a GTimeVal structure which holds
75  *   the time at which the caller started to process the data
76  * @param progress The current progress (0..1)
77  * @return The newly created progress dialog
78  */
79 progdlg_t *
80 delayed_create_progress_dlg(const gpointer top_level_window, const gchar *task_title, const gchar *item_title,
81     gboolean terminate_is_stop, gboolean *stop_flag,
82     const GTimeVal *start_time, gfloat progress);
83
84 /**
85  * Update the progress information of the progress dialog box.
86  *
87  * @param dlg The progress dialog from create_progress_dlg()
88  * @param percentage The current percentage value (0..1)
89  * @param status the New status string to show, e.g. "3000KB of 6000KB"
90  */
91 void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status);
92
93 /**
94  * Destroy or hide the progress bar.
95  *
96  * @param dlg The progress dialog from create_progress_dlg()
97  */
98 void destroy_progress_dlg(progdlg_t *dlg);
99
100 #ifdef __cplusplus
101 }
102 #endif /* __cplusplus */
103
104 #endif /* __PROGRESS_DLG_H__ */
105
106 /*
107  * Editor modelines
108  *
109  * Local Variables:
110  * c-basic-offset: 4
111  * tab-width: 8
112  * indent-tabs-mode: nil
113  * End:
114  *
115  * ex: set shiftwidth=4 tabstop=8 expandtab:
116  * :indentSize=4:tabSize=8:noTabs=true:
117  */