g_simple_async_result_new
g_simple_async_result_new_error
g_simple_async_result_new_from_error
+g_simple_async_result_new_take_error
g_simple_async_result_set_op_res_gpointer
g_simple_async_result_get_op_res_gpointer
g_simple_async_result_set_op_res_gssize
g_simple_async_result_complete_in_idle
g_simple_async_result_run_in_thread
g_simple_async_result_set_from_error
+g_simple_async_result_take_error
g_simple_async_result_propagate_error
g_simple_async_result_set_error
g_simple_async_result_set_error_va
*
* To create a new #GSimpleAsyncResult, call g_simple_async_result_new().
* If the result needs to be created for a #GError, use
- * g_simple_async_result_new_from_error(). If a #GError is not available
+ * g_simple_async_result_new_from_error() or
+ * g_simple_async_result_new_take_error(). If a #GError is not available
* (e.g. the asynchronous operation's doesn't take a #GError argument),
* but the result still needs to be created for an error condition, use
* g_simple_async_result_new_error() (or g_simple_async_result_set_error_va()
* @source_object: a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
- * @error: a #GError location.
+ * @error: a #GError
*
* Creates a #GSimpleAsyncResult from an error condition.
*
g_simple_async_result_new_from_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
- GError *error)
+ const GError *error)
{
GSimpleAsyncResult *simple;
}
/**
+ * g_simple_async_result_new_take_error:
+ * @source_object: (allow-none): a #GObject, or %NULL
+ * @callback: a #GAsyncReadyCallback
+ * @user_data: (allow-none): user data passed to @callback
+ * @error: a #GError
+ *
+ * Creates a #GSimpleAsyncResult from an error condition, and takes over the
+ * caller's ownership of @error, so the caller does not need to free it anymore.
+ *
+ * Returns: a #GSimpleAsyncResult
+ *
+ * Since: 2.26
+ **/
+GSimpleAsyncResult *
+g_simple_async_result_new_take_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GError *error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail (!source_object || G_IS_OBJECT (source_object), NULL);
+
+ simple = g_simple_async_result_new (source_object,
+ callback,
+ user_data, NULL);
+ g_simple_async_result_take_error (simple, error);
+
+ return simple;
+}
+
+/**
* g_simple_async_result_new_error:
* @source_object: a #GObject, or %NULL.
* @callback: a #GAsyncReadyCallback.
}
/**
+ * g_simple_async_result_take_error:
+ * @simple: a #GSimpleAsyncResult
+ * @error: a #GError
+ *
+ * Sets the result from @error, and takes over the caller's ownership
+ * of @error, so the caller does not need to free it any more.
+ *
+ * Since: 2.26
+ **/
+void
+g_simple_async_result_take_error (GSimpleAsyncResult *simple,
+ GError *error)
+{
+ g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
+ g_return_if_fail (error != NULL);
+
+ if (simple->error)
+ g_error_free (simple->error);
+ simple->error = error;
+ simple->failed = TRUE;
+}
+
+/**
* g_simple_async_result_set_error_va:
* @simple: a #GSimpleAsyncResult.
* @domain: a #GQuark (usually #G_IO_ERROR).
GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
+ const GError *error);
+GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
GError *error);
void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
GCancellable *cancellable);
void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
const GError *error);
+void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
+ GError *error);
gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
GError **dest);
void g_simple_async_result_set_error (GSimpleAsyncResult *simple,