1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2009 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.1 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, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __G_ASYNC_INITABLE_H__
22#define __G_ASYNC_INITABLE_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/giotypes.h>
29#include <gio/ginitable.h>
30
31G_BEGIN_DECLS
32
33#define G_TYPE_ASYNC_INITABLE (g_async_initable_get_type ())
34#define G_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitable))
35#define G_IS_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_INITABLE))
36#define G_ASYNC_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitableIface))
37#define G_TYPE_IS_ASYNC_INITABLE(type) (g_type_is_a ((type), G_TYPE_ASYNC_INITABLE))
38
39/**
40 * GAsyncInitable:
41 *
42 * Interface for asynchronously initializable objects.
43 *
44 * Since: 2.22
45 **/
46typedef struct _GAsyncInitableIface GAsyncInitableIface;
47
48/**
49 * GAsyncInitableIface:
50 * @g_iface: The parent interface.
51 * @init_async: Starts initialization of the object.
52 * @init_finish: Finishes initialization of the object.
53 *
54 * Provides an interface for asynchronous initializing object such that
55 * initialization may fail.
56 *
57 * Since: 2.22
58 **/
59struct _GAsyncInitableIface
60{
61 GTypeInterface g_iface;
62
63 /* Virtual Table */
64
65 void (* init_async) (GAsyncInitable *initable,
66 int io_priority,
67 GCancellable *cancellable,
68 GAsyncReadyCallback callback,
69 gpointer user_data);
70 gboolean (* init_finish) (GAsyncInitable *initable,
71 GAsyncResult *res,
72 GError **error);
73};
74
75GLIB_AVAILABLE_IN_ALL
76GType g_async_initable_get_type (void) G_GNUC_CONST;
77
78
79GLIB_AVAILABLE_IN_ALL
80void g_async_initable_init_async (GAsyncInitable *initable,
81 int io_priority,
82 GCancellable *cancellable,
83 GAsyncReadyCallback callback,
84 gpointer user_data);
85GLIB_AVAILABLE_IN_ALL
86gboolean g_async_initable_init_finish (GAsyncInitable *initable,
87 GAsyncResult *res,
88 GError **error);
89
90GLIB_AVAILABLE_IN_ALL
91void g_async_initable_new_async (GType object_type,
92 int io_priority,
93 GCancellable *cancellable,
94 GAsyncReadyCallback callback,
95 gpointer user_data,
96 const gchar *first_property_name,
97 ...);
98
99G_GNUC_BEGIN_IGNORE_DEPRECATIONS
100
101GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async)
102void g_async_initable_newv_async (GType object_type,
103 guint n_parameters,
104 GParameter *parameters,
105 int io_priority,
106 GCancellable *cancellable,
107 GAsyncReadyCallback callback,
108 gpointer user_data);
109
110G_GNUC_END_IGNORE_DEPRECATIONS
111
112GLIB_AVAILABLE_IN_ALL
113void g_async_initable_new_valist_async (GType object_type,
114 const gchar *first_property_name,
115 va_list var_args,
116 int io_priority,
117 GCancellable *cancellable,
118 GAsyncReadyCallback callback,
119 gpointer user_data);
120GLIB_AVAILABLE_IN_ALL
121GObject *g_async_initable_new_finish (GAsyncInitable *initable,
122 GAsyncResult *res,
123 GError **error);
124
125
126
127G_END_DECLS
128
129
130#endif /* __G_ASYNC_INITABLE_H__ */
131

source code of gtk/subprojects/glib/gio/gasyncinitable.h