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, write to the 17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 18 * Boston, MA 02111-1307, USA. 19 * 20 * Author: Alexander Larsson <alexl@redhat.com> 21 */ 22 23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) 24 #error "Only <gio/gio.h> can be included directly." 25 #endif 26 27 #ifndef __G_SIMPLE_ASYNC_RESULT_H__ 28 #define __G_SIMPLE_ASYNC_RESULT_H__ 29 30 #include <gio/giotypes.h> 31 32 G_BEGIN_DECLS 33 34 #define G_TYPE_SIMPLE_ASYNC_RESULT (g_simple_async_result_get_type ()) 35 #define G_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult)) 36 #define G_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass)) 37 #define G_IS_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT)) 38 #define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT)) 39 #define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass)) 40 41 /** 42 * GSimpleAsyncResult: 43 * 44 * A simple implementation of #GAsyncResult. 45 **/ 46 typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass; 47 48 49 GType g_simple_async_result_get_type (void) G_GNUC_CONST; 50 51 GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object, 52 GAsyncReadyCallback callback, 53 gpointer user_data, 54 gpointer source_tag); 55 GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object, 56 GAsyncReadyCallback callback, 57 gpointer user_data, 58 GQuark domain, 59 gint code, 60 const char *format, 61 ...) G_GNUC_PRINTF (6, 7); 62 GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object, 63 GAsyncReadyCallback callback, 64 gpointer user_data, 65 GError *error); 66 67 void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple, 68 gpointer op_res, 69 GDestroyNotify destroy_op_res); 70 gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple); 71 72 void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple, 73 gssize op_res); 74 gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple); 75 76 void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple, 77 gboolean op_res); 78 gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple); 79 80 81 82 gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple); 83 void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple, 84 gboolean handle_cancellation); 85 void g_simple_async_result_complete (GSimpleAsyncResult *simple); 86 void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple); 87 void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple, 88 GSimpleAsyncThreadFunc func, 89 int io_priority, 90 GCancellable *cancellable); 91 void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple, 92 GError *error); 93 gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple, 94 GError **dest); 95 void g_simple_async_result_set_error (GSimpleAsyncResult *simple, 96 GQuark domain, 97 gint code, 98 const char *format, 99 ...) G_GNUC_PRINTF (4, 5); 100 void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple, 101 GQuark domain, 102 gint code, 103 const char *format, 104 va_list args); 105 gboolean g_simple_async_result_is_valid (GAsyncResult *result, 106 GObject *source, 107 gpointer source_tag); 108 109 void g_simple_async_report_error_in_idle (GObject *object, 110 GAsyncReadyCallback callback, 111 gpointer user_data, 112 GQuark domain, 113 gint code, 114 const char *format, 115 ...); 116 void g_simple_async_report_gerror_in_idle (GObject *object, 117 GAsyncReadyCallback callback, 118 gpointer user_data, 119 GError *error); 120 121 G_END_DECLS 122 123 124 125 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */ 126