1 #ifndef GO_IO_CONTEXT_PRIV_H
2 #define GO_IO_CONTEXT_PRIV_H
3 
4 #include <goffice/app/io-context.h>
5 #include <goffice/app/error-info.h>
6 #include <goffice/app/go-cmd-context-impl.h>
7 
8 G_BEGIN_DECLS
9 
10 #define GO_IO_CONTEXT_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GO_TYPE_IO_CONTEXT, GOIOContextClass))
11 #define GO_IS_IO_CONTEXT_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GO_TYPE_IO_CONTEXT))
12 
13 typedef enum {
14 	GO_PROGRESS_HELPER_NONE,
15 	GO_PROGRESS_HELPER_COUNT,
16 	GO_PROGRESS_HELPER_VALUE,
17 	GO_PROGRESS_HELPER_LAST
18 } GOProgressHelperType;
19 
20 typedef struct {
21 	GOProgressHelperType helper_type;
22 	union {
23 		struct {
24 			gchar *start;
25 			gint size;
26 		} mem;
27 		struct {
28 			gint total, last, current;
29 			gint step;
30 		} count;
31 		struct {
32 			gint total, last;
33 			gint step;
34 		} value;
35 		struct {
36 			gint n_elements, last, current;
37 			gint step;
38 		} workbook;
39 	} v;
40 } GOProgressHelper;
41 
42 typedef struct {
43 	double min, max;
44 } GOProgressRange;
45 
46 struct _GOIOContext {
47 	GObject base;
48 
49 	GOCmdContext	*impl;
50 	GSList          *info; /* GSList of GOErrorInfo in reverse order */
51 	gboolean	 error_occurred;
52 	gboolean	 warning_occurred;
53 
54 	GList	*progress_ranges;
55 	double	 progress_min, progress_max;
56 	gdouble  last_progress;
57 	gdouble  last_time;
58 	GOProgressHelper helper;
59 	gboolean exec_main_loop;
60 };
61 
62 struct _GOIOContextClass {
63 	GObjectClass base;
64 	void  (*set_num_files)   (GOIOContext *ioc, guint count);
65 	void  (*processing_file) (GOIOContext *ioc, char const *uri);
66 };
67 
68 G_END_DECLS
69 
70 #endif /* GO_IO_CONTEXT_PRIV_H */
71