gsimpleasyncresult.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 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_SIMPLE_ASYNC_RESULT_H__
  21. #define __G_SIMPLE_ASYNC_RESULT_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. G_BEGIN_DECLS
  27. #define G_TYPE_SIMPLE_ASYNC_RESULT (g_simple_async_result_get_type ())
  28. #define G_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
  29. #define G_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
  30. #define G_IS_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
  31. #define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
  32. #define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
  33. /**
  34. * GSimpleAsyncResult:
  35. *
  36. * A simple implementation of #GAsyncResult.
  37. **/
  38. typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
  39. GLIB_AVAILABLE_IN_ALL
  40. GType g_simple_async_result_get_type (void) G_GNUC_CONST;
  41. GLIB_AVAILABLE_IN_ALL
  42. GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
  43. GAsyncReadyCallback callback,
  44. gpointer user_data,
  45. gpointer source_tag);
  46. GLIB_AVAILABLE_IN_ALL
  47. GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
  48. GAsyncReadyCallback callback,
  49. gpointer user_data,
  50. GQuark domain,
  51. gint code,
  52. const char *format,
  53. ...) G_GNUC_PRINTF (6, 7);
  54. GLIB_AVAILABLE_IN_ALL
  55. GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
  56. GAsyncReadyCallback callback,
  57. gpointer user_data,
  58. const GError *error);
  59. GLIB_AVAILABLE_IN_ALL
  60. GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
  61. GAsyncReadyCallback callback,
  62. gpointer user_data,
  63. GError *error);
  64. GLIB_AVAILABLE_IN_ALL
  65. void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
  66. gpointer op_res,
  67. GDestroyNotify destroy_op_res);
  68. GLIB_AVAILABLE_IN_ALL
  69. gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
  70. GLIB_AVAILABLE_IN_ALL
  71. void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
  72. gssize op_res);
  73. GLIB_AVAILABLE_IN_ALL
  74. gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
  75. GLIB_AVAILABLE_IN_ALL
  76. void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
  77. gboolean op_res);
  78. GLIB_AVAILABLE_IN_ALL
  79. gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
  80. GLIB_AVAILABLE_IN_2_32
  81. void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
  82. GCancellable *check_cancellable);
  83. GLIB_AVAILABLE_IN_ALL
  84. gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
  85. GLIB_AVAILABLE_IN_ALL
  86. void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
  87. gboolean handle_cancellation);
  88. GLIB_AVAILABLE_IN_ALL
  89. void g_simple_async_result_complete (GSimpleAsyncResult *simple);
  90. GLIB_AVAILABLE_IN_ALL
  91. void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
  92. GLIB_AVAILABLE_IN_ALL
  93. void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
  94. GSimpleAsyncThreadFunc func,
  95. int io_priority,
  96. GCancellable *cancellable);
  97. GLIB_AVAILABLE_IN_ALL
  98. void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
  99. const GError *error);
  100. GLIB_AVAILABLE_IN_ALL
  101. void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
  102. GError *error);
  103. GLIB_AVAILABLE_IN_ALL
  104. gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
  105. GError **dest);
  106. GLIB_AVAILABLE_IN_ALL
  107. void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
  108. GQuark domain,
  109. gint code,
  110. const char *format,
  111. ...) G_GNUC_PRINTF (4, 5);
  112. GLIB_AVAILABLE_IN_ALL
  113. void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
  114. GQuark domain,
  115. gint code,
  116. const char *format,
  117. va_list args)
  118. G_GNUC_PRINTF(4, 0);
  119. GLIB_AVAILABLE_IN_ALL
  120. gboolean g_simple_async_result_is_valid (GAsyncResult *result,
  121. GObject *source,
  122. gpointer source_tag);
  123. GLIB_AVAILABLE_IN_ALL
  124. void g_simple_async_report_error_in_idle (GObject *object,
  125. GAsyncReadyCallback callback,
  126. gpointer user_data,
  127. GQuark domain,
  128. gint code,
  129. const char *format,
  130. ...) G_GNUC_PRINTF(6, 7);
  131. GLIB_AVAILABLE_IN_ALL
  132. void g_simple_async_report_gerror_in_idle (GObject *object,
  133. GAsyncReadyCallback callback,
  134. gpointer user_data,
  135. const GError *error);
  136. GLIB_AVAILABLE_IN_ALL
  137. void g_simple_async_report_take_gerror_in_idle (GObject *object,
  138. GAsyncReadyCallback callback,
  139. gpointer user_data,
  140. GError *error);
  141. G_END_DECLS
  142. #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */