gio/ docs/reference/gio Merged gio-standalone into glib.
[platform/upstream/glib.git] / gio / gsimpleasyncresult.h
1 /* GIO - GLib Input, Output and Streaming Library
2  * 
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #ifndef __G_SIMPLE_ASYNC_RESULT_H__
24 #define __G_SIMPLE_ASYNC_RESULT_H__
25
26 #include <gio/gasyncresult.h>
27 #include <gio/gcancellable.h>
28
29 G_BEGIN_DECLS
30
31 #define G_TYPE_SIMPLE_ASYNC_RESULT         (g_simple_async_result_get_type ())
32 #define G_SIMPLE_ASYNC_RESULT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
33 #define G_SIMPLE_ASYNC_RESULT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
34 #define G_IS_SIMPLE_ASYNC_RESULT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
35 #define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
36 #define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
37
38 typedef struct _GSimpleAsyncResult        GSimpleAsyncResult;
39 typedef struct _GSimpleAsyncResultClass   GSimpleAsyncResultClass;
40
41 typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
42                                         GObject *object,
43                                         GCancellable *cancellable);
44
45
46 GType g_simple_async_result_get_type (void) G_GNUC_CONST;
47   
48 GSimpleAsyncResult *g_simple_async_result_new              (GObject                 *source_object,
49                                                             GAsyncReadyCallback      callback,
50                                                             gpointer                 user_data,
51                                                             gpointer                 source_tag);
52 GSimpleAsyncResult *g_simple_async_result_new_error        (GObject                 *source_object,
53                                                             GAsyncReadyCallback      callback,
54                                                             gpointer                 user_data,
55                                                             GQuark                   domain,
56                                                             gint                     code,
57                                                             const char              *format,
58                                                             ...) G_GNUC_PRINTF (6, 7);
59 GSimpleAsyncResult *g_simple_async_result_new_from_error   (GObject                 *source_object,
60                                                             GAsyncReadyCallback      callback,
61                                                             gpointer                 user_data,
62                                                             GError                  *error);
63
64 void                g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult      *simple,
65                                                                gpointer                 op_res,
66                                                                GDestroyNotify           destroy_op_res);
67 gpointer            g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult      *simple);
68
69 void                g_simple_async_result_set_op_res_gssize   (GSimpleAsyncResult      *simple,
70                                                                gssize                   op_res);
71 gssize              g_simple_async_result_get_op_res_gssize   (GSimpleAsyncResult      *simple);
72
73 void                g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult      *simple,
74                                                                gboolean                 op_res);
75 gboolean            g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult      *simple);
76
77
78
79 gpointer            g_simple_async_result_get_source_tag   (GSimpleAsyncResult      *simple);
80 void                g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult      *simple,
81                                                                    gboolean          handle_cancellation);
82 void                g_simple_async_result_complete         (GSimpleAsyncResult      *simple);
83 void                g_simple_async_result_complete_in_idle (GSimpleAsyncResult      *simple);
84 void                g_simple_async_result_run_in_thread    (GSimpleAsyncResult      *simple,
85                                                             GSimpleAsyncThreadFunc   func,
86                                                             int                      io_priority,
87                                                             GCancellable            *cancellable);
88 void                g_simple_async_result_set_from_error   (GSimpleAsyncResult      *simple,
89                                                             GError                  *error);
90 gboolean            g_simple_async_result_propagate_error  (GSimpleAsyncResult      *simple,
91                                                             GError                 **dest);
92 void                g_simple_async_result_set_error        (GSimpleAsyncResult      *simple,
93                                                             GQuark                   domain,
94                                                             gint                     code,
95                                                             const char              *format,
96                                                             ...) G_GNUC_PRINTF (4, 5);
97 void                g_simple_async_result_set_error_va     (GSimpleAsyncResult      *simple,
98                                                             GQuark                   domain,
99                                                             gint                     code,
100                                                             const char              *format,
101                                                             va_list                  args);
102
103 void g_simple_async_report_error_in_idle (GObject *object,
104                                           GAsyncReadyCallback callback,
105                                           gpointer user_data,
106                                           GQuark         domain,
107                                           gint           code,
108                                           const char    *format,
109                                           ...);
110
111 G_END_DECLS
112
113
114   
115 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */