gio: add g_async_result_is_tagged()

Rather than doing a two step first-check-the-GAsyncResult-subtype-then-
check-the-tag, add a GAsyncResult-level method so that you can do them
both at once, simplifying the code for "short-circuit" async return
values where the vmethod never gets called.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
This commit is contained in:
Dan Winship
2012-05-10 11:09:52 -04:00
parent f8532a13e2
commit 82d914d808
11 changed files with 69 additions and 73 deletions

View File

@@ -50,6 +50,7 @@ typedef struct _GAsyncResultIface GAsyncResultIface;
* @g_iface: The parent interface.
* @get_user_data: Gets the user data passed to the callback.
* @get_source_object: Gets the source object that issued the asynchronous operation.
* @is_tagged: Checks if a result is tagged with a particular source.
*
* Interface definition for #GAsyncResult.
**/
@@ -61,6 +62,9 @@ struct _GAsyncResultIface
gpointer (* get_user_data) (GAsyncResult *res);
GObject * (* get_source_object) (GAsyncResult *res);
gboolean (* is_tagged) (GAsyncResult *res,
gpointer tag);
};
GType g_async_result_get_type (void) G_GNUC_CONST;
@@ -71,6 +75,9 @@ GObject *g_async_result_get_source_object (GAsyncResult *res);
GLIB_AVAILABLE_IN_2_34
gboolean g_async_result_legacy_propagate_error (GAsyncResult *res,
GError **error);
GLIB_AVAILABLE_IN_2_34
gboolean g_async_result_is_tagged (GAsyncResult *res,
gpointer source_tag);
G_END_DECLS