gasyncinitable.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 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 <[email protected]>
  19. */
  20. #ifndef __G_ASYNC_INITABLE_H__
  21. #define __G_ASYNC_INITABLE_H__
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #include <gio/giotypes.h>
  26. #include <gio/ginitable.h>
  27. G_BEGIN_DECLS
  28. #define G_TYPE_ASYNC_INITABLE (g_async_initable_get_type ())
  29. #define G_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitable))
  30. #define G_IS_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_INITABLE))
  31. #define G_ASYNC_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitableIface))
  32. #define G_TYPE_IS_ASYNC_INITABLE(type) (g_type_is_a ((type), G_TYPE_ASYNC_INITABLE))
  33. /**
  34. * GAsyncInitable:
  35. *
  36. * Interface for asynchronously initializable objects.
  37. *
  38. * Since: 2.22
  39. **/
  40. typedef struct _GAsyncInitableIface GAsyncInitableIface;
  41. /**
  42. * GAsyncInitableIface:
  43. * @g_iface: The parent interface.
  44. * @init_async: Starts initialization of the object.
  45. * @init_finish: Finishes initialization of the object.
  46. *
  47. * Provides an interface for asynchronous initializing object such that
  48. * initialization may fail.
  49. *
  50. * Since: 2.22
  51. **/
  52. struct _GAsyncInitableIface
  53. {
  54. GTypeInterface g_iface;
  55. /* Virtual Table */
  56. void (* init_async) (GAsyncInitable *initable,
  57. int io_priority,
  58. GCancellable *cancellable,
  59. GAsyncReadyCallback callback,
  60. gpointer user_data);
  61. gboolean (* init_finish) (GAsyncInitable *initable,
  62. GAsyncResult *res,
  63. GError **error);
  64. };
  65. GLIB_AVAILABLE_IN_ALL
  66. GType g_async_initable_get_type (void) G_GNUC_CONST;
  67. GLIB_AVAILABLE_IN_ALL
  68. void g_async_initable_init_async (GAsyncInitable *initable,
  69. int io_priority,
  70. GCancellable *cancellable,
  71. GAsyncReadyCallback callback,
  72. gpointer user_data);
  73. GLIB_AVAILABLE_IN_ALL
  74. gboolean g_async_initable_init_finish (GAsyncInitable *initable,
  75. GAsyncResult *res,
  76. GError **error);
  77. GLIB_AVAILABLE_IN_ALL
  78. void g_async_initable_new_async (GType object_type,
  79. int io_priority,
  80. GCancellable *cancellable,
  81. GAsyncReadyCallback callback,
  82. gpointer user_data,
  83. const gchar *first_property_name,
  84. ...);
  85. GLIB_AVAILABLE_IN_ALL
  86. void g_async_initable_newv_async (GType object_type,
  87. guint n_parameters,
  88. GParameter *parameters,
  89. int io_priority,
  90. GCancellable *cancellable,
  91. GAsyncReadyCallback callback,
  92. gpointer user_data);
  93. GLIB_AVAILABLE_IN_ALL
  94. void g_async_initable_new_valist_async (GType object_type,
  95. const gchar *first_property_name,
  96. va_list var_args,
  97. int io_priority,
  98. GCancellable *cancellable,
  99. GAsyncReadyCallback callback,
  100. gpointer user_data);
  101. GLIB_AVAILABLE_IN_ALL
  102. GObject *g_async_initable_new_finish (GAsyncInitable *initable,
  103. GAsyncResult *res,
  104. GError **error);
  105. G_END_DECLS
  106. #endif /* __G_ASYNC_INITABLE_H__ */