1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
3 * Authors: Michael Zucchi <NotZed@Ximian.com>
5 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
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.
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.
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
22 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
23 #error "Only <camel/camel.h> can be included directly."
26 #ifndef CAMEL_OPERATION_H
27 #define CAMEL_OPERATION_H
33 /* cancellation helper stuff, not yet finalised */
35 typedef struct _CamelOperation CamelOperation;
37 typedef void (*CamelOperationStatusFunc)(struct _CamelOperation *op, const gchar *what, gint pc, gpointer data);
39 typedef enum _camel_operation_status_t {
40 CAMEL_OPERATION_START = -1,
41 CAMEL_OPERATION_END = -2
42 } camel_operation_status_t;
44 /* main thread functions */
45 CamelOperation *camel_operation_new(CamelOperationStatusFunc status, gpointer status_data);
46 void camel_operation_mute(CamelOperation *cc);
47 void camel_operation_ref(CamelOperation *cc);
48 void camel_operation_unref(CamelOperation *cc);
49 void camel_operation_cancel(CamelOperation *cc);
50 void camel_operation_uncancel(CamelOperation *cc);
51 /* subthread functions */
52 CamelOperation *camel_operation_register(CamelOperation *cc);
53 void camel_operation_unregister (CamelOperation *cc);
55 /* called internally by camel, for the current thread */
56 gint camel_operation_cancel_check(CamelOperation *cc);
57 gint camel_operation_cancel_fd(CamelOperation *cc);
59 struct PRFileDesc *camel_operation_cancel_prfd(CamelOperation *cc);
61 /* return the registered operation for this thread, if there is one */
62 CamelOperation *camel_operation_registered(void);
64 void camel_operation_start(CamelOperation *cc, const gchar *what, ...);
65 void camel_operation_start_transient(CamelOperation *cc, const gchar *what, ...);
66 void camel_operation_progress(CamelOperation *cc, gint pc);
67 void camel_operation_end(CamelOperation *cc);
71 #endif /* CAMEL_OPERATION_H */