Commit ec9c248d authored by Dan Winship's avatar Dan Winship

gio: deprecate GSimpleAsyncResult

GTask has been around for a long time now, everything in GLib is using
it, and the run-in-thread deadlock problems should be fixed now.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
parent f10b6550
......@@ -286,6 +286,7 @@ g_async_initable_real_init_finish (GAsyncInitable *initable,
* even though g_async_initable_real_init_async doesn't generate
* them any more.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (G_IS_SIMPLE_ASYNC_RESULT (res))
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
......@@ -294,6 +295,7 @@ g_async_initable_real_init_finish (GAsyncInitable *initable,
else
return TRUE;
}
G_GNUC_END_IGNORE_DEPRECATIONS
g_return_val_if_fail (g_task_is_valid (res, initable), FALSE);
......
......@@ -193,6 +193,7 @@ g_async_result_legacy_propagate_error (GAsyncResult *res,
* deprecation warnings in the future.)
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (G_IS_SIMPLE_ASYNC_RESULT (res))
{
return g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res),
......@@ -200,6 +201,7 @@ g_async_result_legacy_propagate_error (GAsyncResult *res,
}
else
return FALSE;
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
......
......@@ -202,6 +202,8 @@
* ]|
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface);
struct _GSimpleAsyncResult
......@@ -305,6 +307,8 @@ g_simple_async_result_init (GSimpleAsyncResult *simple)
* this function returns.
*
* Returns: a #GSimpleAsyncResult.
*
* Deprecated: 2.46: Use g_task_new() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new (GObject *source_object,
......@@ -338,6 +342,8 @@ g_simple_async_result_new (GObject *source_object,
* Creates a #GSimpleAsyncResult from an error condition.
*
* Returns: a #GSimpleAsyncResult.
*
* Deprecated: 2.46: Use g_task_new() and g_task_return_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_from_error (GObject *source_object,
......@@ -370,6 +376,8 @@ g_simple_async_result_new_from_error (GObject *source_object,
* Returns: a #GSimpleAsyncResult
*
* Since: 2.28
*
* Deprecated: 2.46: Use g_task_new() and g_task_return_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_take_error (GObject *source_object,
......@@ -402,6 +410,8 @@ g_simple_async_result_new_take_error (GObject *source_object,
* Creates a new #GSimpleAsyncResult with a set error.
*
* Returns: a #GSimpleAsyncResult.
*
* Deprecated: 2.46: Use g_task_new() and g_task_return_new_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_error (GObject *source_object,
......@@ -470,6 +480,8 @@ g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface)
* This function has nothing to do with
* g_simple_async_result_set_check_cancellable(). It only refers to the
* #GCancellable passed to g_simple_async_result_run_in_thread().
*
* Deprecated: 2.46
**/
void
g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
......@@ -486,6 +498,8 @@ g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
* Gets the source tag for the #GSimpleAsyncResult.
*
* Returns: a #gpointer to the source object for the #GSimpleAsyncResult.
*
* Deprecated: 2.46. Use #GTask and g_task_get_source_tag() instead.
**/
gpointer
g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
......@@ -507,6 +521,8 @@ g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
* function will return %TRUE with @dest set appropriately.
*
* Returns: %TRUE if the error was propagated to @dest. %FALSE otherwise.
*
* Deprecated: 2.46: Use #GTask instead.
**/
gboolean
g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
......@@ -534,6 +550,8 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
* @destroy_op_res: a #GDestroyNotify function.
*
* Sets the operation result within the asynchronous result to a pointer.
*
* Deprecated: 2.46: Use #GTask and g_task_return_pointer() instead.
**/
void
g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
......@@ -554,6 +572,8 @@ g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
* Gets a pointer result as returned by the asynchronous function.
*
* Returns: a pointer from the result.
*
* Deprecated: 2.46: Use #GTask and g_task_propagate_pointer() instead.
**/
gpointer
g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
......@@ -569,6 +589,8 @@ g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
*
* Sets the operation result within the asynchronous result to
* the given @op_res.
*
* Deprecated: 2.46: Use #GTask and g_task_return_int() instead.
**/
void
g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
......@@ -586,6 +608,8 @@ g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
* Gets a gssize from the asynchronous result.
*
* Returns: a gssize returned from the asynchronous function.
*
* Deprecated: 2.46: Use #GTask and g_task_propagate_int() instead.
**/
gssize
g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
......@@ -600,6 +624,8 @@ g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
* @op_res: a #gboolean.
*
* Sets the operation result to a boolean within the asynchronous result.
*
* Deprecated: 2.46: Use #GTask and g_task_return_boolean() instead.
**/
void
g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
......@@ -618,6 +644,8 @@ g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
*
* Returns: %TRUE if the operation's result was %TRUE, %FALSE
* if the operation's result was %FALSE.
*
* Deprecated: 2.46: Use #GTask and g_task_propagate_boolean() instead.
**/
gboolean
g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
......@@ -632,6 +660,8 @@ g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
* @error: #GError.
*
* Sets the result from a #GError.
*
* Deprecated: 2.46: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
......@@ -655,6 +685,8 @@ g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
* of @error, so the caller does not need to free it any more.
*
* Since: 2.28
*
* Deprecated: 2.46: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_take_error (GSimpleAsyncResult *simple,
......@@ -679,6 +711,8 @@ g_simple_async_result_take_error (GSimpleAsyncResult *simple,
*
* Sets an error within the asynchronous result without a #GError.
* Unless writing a binding, see g_simple_async_result_set_error().
*
* Deprecated: 2.46: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
......@@ -706,6 +740,8 @@ g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
* @...: a list of variables to fill in @format.
*
* Sets an error within the asynchronous result without a #GError.
*
* Deprecated: 2.46: Use #GTask and g_task_return_new_error() instead.
**/
void
g_simple_async_result_set_error (GSimpleAsyncResult *simple,
......@@ -736,6 +772,8 @@ g_simple_async_result_set_error (GSimpleAsyncResult *simple,
*
* Calling this function takes a reference to @simple for as long as
* is needed to complete the call.
*
* Deprecated: 2.46: Use #GTask instead.
**/
void
g_simple_async_result_complete (GSimpleAsyncResult *simple)
......@@ -788,6 +826,8 @@ complete_in_idle_cb (gpointer data)
*
* Calling this function takes a reference to @simple for as long as
* is needed to complete the call.
*
* Deprecated: 2.46: Use #GTask instead.
*/
void
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
......@@ -883,6 +923,8 @@ run_in_thread (GIOSchedulerJob *job,
*
* Calling this function takes a reference to @simple for as long as
* is needed to run the job and report its completion.
*
* Deprecated: 2.46: Use #GTask and g_task_run_in_thread() instead.
*/
void
g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
......@@ -928,6 +970,8 @@ g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
* Returns: #TRUE if all checks passed or #FALSE if any failed.
*
* Since: 2.20
*
* Deprecated: 2.46: Use #GTask and g_task_is_valid() instead.
**/
gboolean
g_simple_async_result_is_valid (GAsyncResult *result,
......@@ -970,6 +1014,8 @@ g_simple_async_result_is_valid (GAsyncResult *result,
* Reports an error in an asynchronous function in an idle function by
* directly setting the contents of the #GAsyncResult with the given error
* information.
*
* Deprecated: 2.46: Use g_task_report_error().
**/
void
g_simple_async_report_error_in_idle (GObject *object,
......@@ -1008,6 +1054,8 @@ g_simple_async_report_error_in_idle (GObject *object,
* Reports an error in an idle function. Similar to
* g_simple_async_report_error_in_idle(), but takes a #GError rather
* than building a new one.
*
* Deprecated: 2.46: Use g_task_report_error().
**/
void
g_simple_async_report_gerror_in_idle (GObject *object,
......@@ -1040,6 +1088,8 @@ g_simple_async_report_gerror_in_idle (GObject *object,
* ownership of @error, so the caller does not have to free it any more.
*
* Since: 2.28
*
* Deprecated: 2.46: Use g_task_report_error().
**/
void
g_simple_async_report_take_gerror_in_idle (GObject *object,
......@@ -1082,6 +1132,8 @@ g_simple_async_report_take_gerror_in_idle (GObject *object,
* unrelated g_simple_async_result_set_handle_cancellation() function.
*
* Since: 2.32
*
* Deprecated: 2.46: Use #GTask instead.
**/
void
g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
......@@ -1094,3 +1146,5 @@ g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
if (check_cancellable)
simple->check_cancellable = g_object_ref (check_cancellable);
}
G_GNUC_END_IGNORE_DEPRECATIONS
......@@ -47,12 +47,12 @@ typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
GLIB_AVAILABLE_IN_ALL
GType g_simple_async_result_get_type (void) G_GNUC_CONST;
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
gpointer source_tag);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
......@@ -60,83 +60,83 @@ GSimpleAsyncResult *g_simple_async_result_new_error (GObject
gint code,
const char *format,
...) G_GNUC_PRINTF (6, 7);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
const GError *error);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
GError *error);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
gpointer op_res,
GDestroyNotify destroy_op_res);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
gssize op_res);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
gboolean op_res);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_2_32
GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
GCancellable *check_cancellable);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
gboolean handle_cancellation);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_complete (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
GSimpleAsyncThreadFunc func,
int io_priority,
GCancellable *cancellable);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
const GError *error);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
GError *error);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
GError **dest);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
GQuark domain,
gint code,
const char *format,
...) G_GNUC_PRINTF (4, 5);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
GQuark domain,
gint code,
const char *format,
va_list args)
G_GNUC_PRINTF(4, 0);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46
gboolean g_simple_async_result_is_valid (GAsyncResult *result,
GObject *source,
gpointer source_tag);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
void g_simple_async_report_error_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
......@@ -144,12 +144,12 @@ void g_simple_async_report_error_in_idle (GObject *object,
gint code,
const char *format,
...) G_GNUC_PRINTF(6, 7);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
void g_simple_async_report_gerror_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
const GError *error);
GLIB_AVAILABLE_IN_ALL
GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
void g_simple_async_report_take_gerror_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
......
......@@ -14,6 +14,8 @@
#include <stdlib.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GObject *got_source;
static GAsyncResult *got_result;
static gpointer got_user_data;
......@@ -193,3 +195,5 @@ main (int argc, char **argv)
return g_test_run();
}
G_GNUC_END_IGNORE_DEPRECATIONS
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment