gasyncinitable.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2009 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. */
  22. #ifndef __G_ASYNC_INITABLE_H__
  23. #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."
  26. #endif
  27. #include <gio/giotypes.h>
  28. #include <gio/ginitable.h>
  29. G_BEGIN_DECLS
  30. #define G_TYPE_ASYNC_INITABLE (g_async_initable_get_type ())
  31. #define G_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitable))
  32. #define G_IS_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_INITABLE))
  33. #define G_ASYNC_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitableIface))
  34. #define G_TYPE_IS_ASYNC_INITABLE(type) (g_type_is_a ((type), G_TYPE_ASYNC_INITABLE))
  35. typedef struct _GAsyncInitableIface GAsyncInitableIface;
  36. /**
  37. * GAsyncInitableIface:
  38. * @g_iface: The parent interface.
  39. * @init_async: Starts initialization of the object.
  40. * @init_finish: Finishes initialization of the object.
  41. *
  42. * Provides an interface for asynchronous initializing object such that
  43. * initialization may fail.
  44. *
  45. * Since: 2.22
  46. **/
  47. struct _GAsyncInitableIface
  48. {
  49. GTypeInterface g_iface;
  50. /* Virtual Table */
  51. void (* init_async) (GAsyncInitable *initable,
  52. int io_priority,
  53. GCancellable *cancellable,
  54. GAsyncReadyCallback callback,
  55. gpointer user_data);
  56. gboolean (* init_finish) (GAsyncInitable *initable,
  57. GAsyncResult *res,
  58. GError **error);
  59. };
  60. GIO_AVAILABLE_IN_ALL
  61. GType g_async_initable_get_type (void) G_GNUC_CONST;
  62. GIO_AVAILABLE_IN_ALL
  63. void g_async_initable_init_async (GAsyncInitable *initable,
  64. int io_priority,
  65. GCancellable *cancellable,
  66. GAsyncReadyCallback callback,
  67. gpointer user_data);
  68. GIO_AVAILABLE_IN_ALL
  69. gboolean g_async_initable_init_finish (GAsyncInitable *initable,
  70. GAsyncResult *res,
  71. GError **error);
  72. GIO_AVAILABLE_IN_ALL
  73. void g_async_initable_new_async (GType object_type,
  74. int io_priority,
  75. GCancellable *cancellable,
  76. GAsyncReadyCallback callback,
  77. gpointer user_data,
  78. const gchar *first_property_name,
  79. ...);
  80. G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  81. GIO_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async)
  82. void g_async_initable_newv_async (GType object_type,
  83. guint n_parameters,
  84. GParameter *parameters,
  85. int io_priority,
  86. GCancellable *cancellable,
  87. GAsyncReadyCallback callback,
  88. gpointer user_data);
  89. G_GNUC_END_IGNORE_DEPRECATIONS
  90. GIO_AVAILABLE_IN_ALL
  91. void g_async_initable_new_valist_async (GType object_type,
  92. const gchar *first_property_name,
  93. va_list var_args,
  94. int io_priority,
  95. GCancellable *cancellable,
  96. GAsyncReadyCallback callback,
  97. gpointer user_data);
  98. GIO_AVAILABLE_IN_ALL
  99. GObject *g_async_initable_new_finish (GAsyncInitable *initable,
  100. GAsyncResult *res,
  101. GError **error);
  102. G_END_DECLS
  103. #endif /* __G_ASYNC_INITABLE_H__ */