Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-operation.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  * Authors: Michael Zucchi <NotZed@Ximian.com>
4  *
5  * Copyright 2001 Ximian, Inc. (www.ximian.com/)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19  * USA
20  */
21
22 #ifndef CAMEL_OPERATION_H
23 #define CAMEL_OPERATION_H 1
24
25 G_BEGIN_DECLS
26
27 /* cancellation helper stuff, not yet finalised */
28
29 typedef struct _CamelOperation CamelOperation;
30
31 typedef void (*CamelOperationStatusFunc)(struct _CamelOperation *op, const char *what, int pc, void *data);
32
33 typedef enum _camel_operation_status_t {
34         CAMEL_OPERATION_START = -1,
35         CAMEL_OPERATION_END = -2,
36 } camel_operation_status_t;
37
38 /* main thread functions */
39 CamelOperation *camel_operation_new(CamelOperationStatusFunc status, void *status_data);
40 void camel_operation_mute(CamelOperation *cc);
41 void camel_operation_ref(CamelOperation *cc);
42 void camel_operation_unref(CamelOperation *cc);
43 void camel_operation_cancel(CamelOperation *cc);
44 void camel_operation_uncancel(CamelOperation *cc);
45 /* subthread functions */
46 CamelOperation *camel_operation_register(CamelOperation *cc);
47 void camel_operation_unregister (CamelOperation *cc);
48
49 /* called internally by camel, for the current thread */
50 void camel_operation_cancel_block(CamelOperation *cc);
51 void camel_operation_cancel_unblock(CamelOperation *cc);
52 int camel_operation_cancel_check(CamelOperation *cc);
53 int camel_operation_cancel_fd(CamelOperation *cc);
54 #ifdef HAVE_NSS
55 struct PRFileDesc *camel_operation_cancel_prfd(CamelOperation *cc);
56 #endif
57 /* return the registered operation for this thread, if there is one */
58 CamelOperation *camel_operation_registered(void);
59
60 void camel_operation_start(CamelOperation *cc, char *what, ...);
61 void camel_operation_start_transient(CamelOperation *cc, char *what, ...);
62 void camel_operation_progress(CamelOperation *cc, int pc);
63 void camel_operation_progress_count(CamelOperation *cc, int sofar);
64 void camel_operation_end(CamelOperation *cc);
65
66 G_END_DECLS
67
68 #endif /* CAMEL_OPERATION_H */