1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2009 Red Hat, Inc.
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.
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.
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/>.
18 * Author: Alexander Larsson <alexl@redhat.com>
21 #ifndef __G_ASYNC_INITABLE_H__
22 #define __G_ASYNC_INITABLE_H__
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
28 #include <gio/giotypes.h>
29 #include <gio/ginitable.h>
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))
42 * Interface for asynchronously initializable objects.
46 typedef struct _GAsyncInitableIface GAsyncInitableIface
;
49 * GAsyncInitableIface:
50 * @g_iface: The parent interface.
51 * @init_async: Starts initialization of the object.
52 * @init_finish: Finishes initialization of the object.
54 * Provides an interface for asynchronous initializing object such that
55 * initialization may fail.
59 struct _GAsyncInitableIface
61 GTypeInterface g_iface
;
65 void (* init_async
) (GAsyncInitable
*initable
,
67 GCancellable
*cancellable
,
68 GAsyncReadyCallback callback
,
70 gboolean (* init_finish
) (GAsyncInitable
*initable
,
76 GType
g_async_initable_get_type (void) G_GNUC_CONST
;
80 void g_async_initable_init_async (GAsyncInitable
*initable
,
82 GCancellable
*cancellable
,
83 GAsyncReadyCallback callback
,
86 gboolean
g_async_initable_init_finish (GAsyncInitable
*initable
,
91 void g_async_initable_new_async (GType object_type
,
93 GCancellable
*cancellable
,
94 GAsyncReadyCallback callback
,
96 const gchar
*first_property_name
,
98 GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties
and g_async_initable_init_async
)
99 void g_async_initable_newv_async (GType object_type
,
101 GParameter
*parameters
,
103 GCancellable
*cancellable
,
104 GAsyncReadyCallback callback
,
106 GLIB_AVAILABLE_IN_ALL
107 void g_async_initable_new_valist_async (GType object_type
,
108 const gchar
*first_property_name
,
111 GCancellable
*cancellable
,
112 GAsyncReadyCallback callback
,
114 GLIB_AVAILABLE_IN_ALL
115 GObject
*g_async_initable_new_finish (GAsyncInitable
*initable
,
124 #endif /* __G_ASYNC_INITABLE_H__ */