[glib/wip/task: 12/12] gio: deprecate GSimpleAsyncResult
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/task: 12/12] gio: deprecate GSimpleAsyncResult
- Date: Wed, 5 Sep 2012 14:14:07 +0000 (UTC)
commit 5e10b16ea3637e563ea27be33d0f814cb7e753a1
Author: Dan Winship <danw gnome org>
Date: Tue Apr 17 10:38:37 2012 -0400
gio: deprecate GSimpleAsyncResult
https://bugzilla.gnome.org/show_bug.cgi?id=661767
gio/gasyncinitable.c | 2 +
gio/gasyncresult.c | 2 +
gio/gsimpleasyncresult.c | 56 ++++++++++++++++++++++++++++++++++++++-
gio/gsimpleasyncresult.h | 25 +++++++++++++++++
gio/tests/simple-async-result.c | 4 +++
5 files changed, 88 insertions(+), 1 deletions(-)
---
diff --git a/gio/gasyncinitable.c b/gio/gasyncinitable.c
index 8eb9406..06efca5 100644
--- a/gio/gasyncinitable.c
+++ b/gio/gasyncinitable.c
@@ -289,6 +289,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);
@@ -297,6 +298,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);
diff --git a/gio/gasyncresult.c b/gio/gasyncresult.c
index 016e9bc..b12ddd3 100644
--- a/gio/gasyncresult.c
+++ b/gio/gasyncresult.c
@@ -196,6 +196,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),
@@ -203,6 +204,7 @@ g_async_result_legacy_propagate_error (GAsyncResult *res,
}
else
return FALSE;
+ G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
diff --git a/gio/gsimpleasyncresult.c b/gio/gsimpleasyncresult.c
index 9317afb..4839f89 100644
--- a/gio/gsimpleasyncresult.c
+++ b/gio/gsimpleasyncresult.c
@@ -46,7 +46,7 @@
* @see_also: #GAsyncResult
*
* <note><para>
- * As of GLib 2.34, #GSimpleAsyncResult is deprecated in favor of
+ * As of GLib 2.36, #GSimpleAsyncResult is deprecated in favor of
* #GTask, which provides a simpler API.
* </para></note>
*
@@ -216,6 +216,8 @@
* ]|
*/
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
static void g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface);
struct _GSimpleAsyncResult
@@ -319,6 +321,8 @@ g_simple_async_result_init (GSimpleAsyncResult *simple)
* this function returns.
*
* Returns: a #GSimpleAsyncResult.
+ *
+ * Deprecated: 2.36: Use g_task_new() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new (GObject *source_object,
@@ -352,6 +356,8 @@ g_simple_async_result_new (GObject *source_object,
* Creates a #GSimpleAsyncResult from an error condition.
*
* Returns: a #GSimpleAsyncResult.
+ *
+ * Deprecated: 2.36: Use g_task_new() and g_task_return_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_from_error (GObject *source_object,
@@ -384,6 +390,8 @@ g_simple_async_result_new_from_error (GObject *source_object,
* Returns: a #GSimpleAsyncResult
*
* Since: 2.28
+ *
+ * Deprecated: 2.36: Use g_task_new() and g_task_return_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_take_error (GObject *source_object,
@@ -416,6 +424,8 @@ g_simple_async_result_new_take_error (GObject *source_object,
* Creates a new #GSimpleAsyncResult with a set error.
*
* Returns: a #GSimpleAsyncResult.
+ *
+ * Deprecated: 2.36: Use g_task_new() and g_task_return_new_error() instead.
**/
GSimpleAsyncResult *
g_simple_async_result_new_error (GObject *source_object,
@@ -484,6 +494,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.36
**/
void
g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
@@ -500,6 +512,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.36. Use #GTask and g_task_get_source_tag() instead.
**/
gpointer
g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
@@ -521,6 +535,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.36: Use #GTask instead.
**/
gboolean
g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
@@ -548,6 +564,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.36: Use #GTask and g_task_return_pointer() instead.
**/
void
g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
@@ -568,6 +586,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.36: Use #GTask and g_task_propagate_pointer() instead.
**/
gpointer
g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
@@ -583,6 +603,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.36: Use #GTask and g_task_return_int() instead.
**/
void
g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
@@ -600,6 +622,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.36: Use #GTask and g_task_propagate_int() instead.
**/
gssize
g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
@@ -614,6 +638,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.36: Use #GTask and g_task_return_boolean() instead.
**/
void
g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
@@ -632,6 +658,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.36: Use #GTask and g_task_propagate_boolean() instead.
**/
gboolean
g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
@@ -646,6 +674,8 @@ g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
* @error: #GError.
*
* Sets the result from a #GError.
+ *
+ * Deprecated: 2.36: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
@@ -669,6 +699,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.36: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_take_error (GSimpleAsyncResult *simple,
@@ -693,6 +725,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.36: Use #GTask and g_task_return_error() instead.
**/
void
g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
@@ -720,6 +754,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.36: Use #GTask and g_task_return_new_error() instead.
**/
void
g_simple_async_result_set_error (GSimpleAsyncResult *simple,
@@ -750,6 +786,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.36: Use #GTask instead.
**/
void
g_simple_async_result_complete (GSimpleAsyncResult *simple)
@@ -802,6 +840,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.36: Use #GTask instead.
*/
void
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
@@ -895,6 +935,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.36: Use #GTask and g_task_run_in_thread() instead.
*/
void
g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
@@ -940,6 +982,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.36: Use #GTask and g_task_is_valid() instead.
**/
gboolean
g_simple_async_result_is_valid (GAsyncResult *result,
@@ -980,6 +1024,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.36: Use g_task_report_error().
**/
void
g_simple_async_report_error_in_idle (GObject *object,
@@ -1018,6 +1064,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.36: Use g_task_report_error().
**/
void
g_simple_async_report_gerror_in_idle (GObject *object,
@@ -1050,6 +1098,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.36: Use g_task_report_error().
**/
void
g_simple_async_report_take_gerror_in_idle (GObject *object,
@@ -1092,6 +1142,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.36: Use #GTask instead.
**/
void
g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
@@ -1104,3 +1156,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
diff --git a/gio/gsimpleasyncresult.h b/gio/gsimpleasyncresult.h
index 7497630..c935159 100644
--- a/gio/gsimpleasyncresult.h
+++ b/gio/gsimpleasyncresult.h
@@ -48,10 +48,12 @@ typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
GType g_simple_async_result_get_type (void) G_GNUC_CONST;
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
gpointer source_tag);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
@@ -59,62 +61,83 @@ GSimpleAsyncResult *g_simple_async_result_new_error (GObject
gint code,
const char *format,
...) G_GNUC_PRINTF (6, 7);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
const GError *error);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_new)
GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
GAsyncReadyCallback callback,
gpointer user_data,
GError *error);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
gpointer op_res,
GDestroyNotify destroy_op_res);
+GLIB_DEPRECATED_IN_2_36
gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
gssize op_res);
+GLIB_DEPRECATED_IN_2_36
gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
gboolean op_res);
+GLIB_DEPRECATED_IN_2_36
gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
GLIB_AVAILABLE_IN_2_32
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
GCancellable *check_cancellable);
+GLIB_DEPRECATED_IN_2_36
gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
gboolean handle_cancellation);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_complete (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
GSimpleAsyncThreadFunc func,
int io_priority,
GCancellable *cancellable);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
const GError *error);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
GError *error);
+GLIB_DEPRECATED_IN_2_36
gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
GError **dest);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
GQuark domain,
gint code,
const char *format,
...) G_GNUC_PRINTF (4, 5);
+GLIB_DEPRECATED_IN_2_36
void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
GQuark domain,
gint code,
const char *format,
va_list args);
+GLIB_DEPRECATED_IN_2_36
gboolean g_simple_async_result_is_valid (GAsyncResult *result,
GObject *source,
gpointer source_tag);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_report_error)
void g_simple_async_report_error_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
@@ -122,10 +145,12 @@ void g_simple_async_report_error_in_idle (GObject *object,
gint code,
const char *format,
...);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_report_error)
void g_simple_async_report_gerror_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
const GError *error);
+GLIB_DEPRECATED_IN_2_36_FOR(g_task_report_error)
void g_simple_async_report_take_gerror_in_idle (GObject *object,
GAsyncReadyCallback callback,
gpointer user_data,
diff --git a/gio/tests/simple-async-result.c b/gio/tests/simple-async-result.c
index 8112057..58b7329 100644
--- a/gio/tests/simple-async-result.c
+++ b/gio/tests/simple-async-result.c
@@ -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;
@@ -129,3 +131,5 @@ main (int argc, char **argv)
return g_test_run();
}
+
+G_GNUC_END_IGNORE_DEPRECATIONS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]