gsimpleasyncresult.h 7.62 KB
Newer Older
1
/* GIO - GLib Input, Output and Streaming Library
2
 *
3 4 5 6 7 8 9 10 11 12 13 14 15
 * Copyright (C) 2006-2007 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
16
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 18 19 20
 *
 * Author: Alexander Larsson <alexl@redhat.com>
 */

21 22 23
#ifndef __G_SIMPLE_ASYNC_RESULT_H__
#define __G_SIMPLE_ASYNC_RESULT_H__

24 25 26 27
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

28
#include <gio/giotypes.h>
29 30 31 32 33 34 35 36 37 38

G_BEGIN_DECLS

#define G_TYPE_SIMPLE_ASYNC_RESULT         (g_simple_async_result_get_type ())
#define G_SIMPLE_ASYNC_RESULT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
#define G_SIMPLE_ASYNC_RESULT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
#define G_IS_SIMPLE_ASYNC_RESULT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
#define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
#define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))

39 40
/**
 * GSimpleAsyncResult:
41
 *
42 43
 * A simple implementation of #GAsyncResult.
 **/
44 45 46
typedef struct _GSimpleAsyncResultClass   GSimpleAsyncResultClass;


47
GLIB_AVAILABLE_IN_ALL
48 49
GType               g_simple_async_result_get_type         (void) G_GNUC_CONST;

50
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
51 52 53 54
GSimpleAsyncResult *g_simple_async_result_new              (GObject                 *source_object,
							    GAsyncReadyCallback      callback,
							    gpointer                 user_data,
							    gpointer                 source_tag);
55
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
56 57 58 59 60 61 62
GSimpleAsyncResult *g_simple_async_result_new_error        (GObject                 *source_object,
							    GAsyncReadyCallback      callback,
							    gpointer                 user_data,
							    GQuark                   domain,
							    gint                     code,
							    const char              *format,
							    ...) G_GNUC_PRINTF (6, 7);
63
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
64
GSimpleAsyncResult *g_simple_async_result_new_from_error   (GObject                 *source_object,
65 66 67
							    GAsyncReadyCallback      callback,
							    gpointer                 user_data,
							    const GError            *error);
68
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
69
GSimpleAsyncResult *g_simple_async_result_new_take_error   (GObject                 *source_object,
70 71 72 73
							    GAsyncReadyCallback      callback,
							    gpointer                 user_data,
							    GError                  *error);

74
GLIB_DEPRECATED_IN_2_46
75 76 77
void                g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult      *simple,
                                                               gpointer                 op_res,
                                                               GDestroyNotify           destroy_op_res);
78
GLIB_DEPRECATED_IN_2_46
79 80
gpointer            g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult      *simple);

81
GLIB_DEPRECATED_IN_2_46
82 83
void                g_simple_async_result_set_op_res_gssize   (GSimpleAsyncResult      *simple,
                                                               gssize                   op_res);
84
GLIB_DEPRECATED_IN_2_46
85 86
gssize              g_simple_async_result_get_op_res_gssize   (GSimpleAsyncResult      *simple);

87
GLIB_DEPRECATED_IN_2_46
88 89
void                g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult      *simple,
                                                               gboolean                 op_res);
90
GLIB_DEPRECATED_IN_2_46
91 92 93 94
gboolean            g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult      *simple);



95
GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
96 97
void                g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
                                                                 GCancellable       *check_cancellable);
98
GLIB_DEPRECATED_IN_2_46
99
gpointer            g_simple_async_result_get_source_tag   (GSimpleAsyncResult      *simple);
100
GLIB_DEPRECATED_IN_2_46
101 102
void                g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult      *simple,
								   gboolean          handle_cancellation);
103
GLIB_DEPRECATED_IN_2_46
104
void                g_simple_async_result_complete         (GSimpleAsyncResult      *simple);
105
GLIB_DEPRECATED_IN_2_46
106
void                g_simple_async_result_complete_in_idle (GSimpleAsyncResult      *simple);
107
GLIB_DEPRECATED_IN_2_46
108 109 110 111
void                g_simple_async_result_run_in_thread    (GSimpleAsyncResult      *simple,
							    GSimpleAsyncThreadFunc   func,
							    int                      io_priority,
							    GCancellable            *cancellable);
112
GLIB_DEPRECATED_IN_2_46
113
void                g_simple_async_result_set_from_error   (GSimpleAsyncResult      *simple,
114
							    const GError            *error);
115
GLIB_DEPRECATED_IN_2_46
116 117
void                g_simple_async_result_take_error       (GSimpleAsyncResult      *simple,
							    GError            *error);
118
GLIB_DEPRECATED_IN_2_46
119 120
gboolean            g_simple_async_result_propagate_error  (GSimpleAsyncResult      *simple,
							    GError                 **dest);
121
GLIB_DEPRECATED_IN_2_46
122 123 124 125 126
void                g_simple_async_result_set_error        (GSimpleAsyncResult      *simple,
							    GQuark                   domain,
							    gint                     code,
							    const char              *format,
							    ...) G_GNUC_PRINTF (4, 5);
127
GLIB_DEPRECATED_IN_2_46
128 129 130 131
void                g_simple_async_result_set_error_va     (GSimpleAsyncResult      *simple,
							    GQuark                   domain,
							    gint                     code,
							    const char              *format,
132 133
							    va_list                  args)
							    G_GNUC_PRINTF(4, 0);
134
GLIB_DEPRECATED_IN_2_46
135 136 137
gboolean            g_simple_async_result_is_valid         (GAsyncResult            *result,
                                                            GObject                 *source,
                                                            gpointer                 source_tag);
138

139
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
140
void g_simple_async_report_error_in_idle  (GObject            *object,
141
					   GAsyncReadyCallback callback,
142 143 144 145
					   gpointer            user_data,
					   GQuark              domain,
					   gint                code,
					   const char         *format,
146
					   ...) G_GNUC_PRINTF(6, 7);
147
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
148
void g_simple_async_report_gerror_in_idle (GObject            *object,
149
					   GAsyncReadyCallback callback,
150
					   gpointer            user_data,
151
					   const GError       *error);
152
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
153 154 155 156
void g_simple_async_report_take_gerror_in_idle (GObject            *object,
                                                GAsyncReadyCallback callback,
                                                gpointer            user_data,
                                                GError             *error);
157 158 159 160

G_END_DECLS


161

162
#endif /* __G_SIMPLE_ASYNC_RESULT_H__ */