diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2011-02-01 16:41:24 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2011-02-01 16:47:08 +0800 |
commit | 267fb729f0536843bcb7c42858bd3d6a6d029411 (patch) | |
tree | 8351e73c5a1dbe92e8bc43a9705ea9705c5e03e5 /libempathy | |
parent | 935d2f62ebc72edfe86ccf4449b7d95ef758bb74 (diff) | |
download | gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar.gz gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar.bz2 gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar.lz gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar.xz gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.tar.zst gsoc2013-empathy-267fb729f0536843bcb7c42858bd3d6a6d029411.zip |
utils: add the _finish macros from wocky
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-utils.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 3c89962c1..f0ac666ed 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -107,6 +107,51 @@ gboolean empathy_connection_can_group_personas (TpConnection *connection); gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert); +/* Copied from wocky/wocky-utils.h */ + +#define empathy_implement_finish_void(source, tag) \ + if (g_simple_async_result_propagate_error (\ + G_SIMPLE_ASYNC_RESULT (result), error)) \ + return FALSE; \ + g_return_val_if_fail (g_simple_async_result_is_valid (result, \ + G_OBJECT(source), tag), \ + FALSE); \ + return TRUE; + +#define empathy_implement_finish_copy_pointer(source, tag, copy_func, \ + out_param) \ + GSimpleAsyncResult *_simple; \ + _simple = (GSimpleAsyncResult *) result; \ + if (g_simple_async_result_propagate_error (_simple, error)) \ + return FALSE; \ + g_return_val_if_fail (g_simple_async_result_is_valid (result, \ + G_OBJECT (source), tag), \ + FALSE); \ + if (out_param != NULL) \ + *out_param = copy_func ( \ + g_simple_async_result_get_op_res_gpointer (_simple)); \ + return TRUE; + +#define empathy_implement_finish_return_copy_pointer(source, tag, copy_func) \ + GSimpleAsyncResult *_simple; \ + _simple = (GSimpleAsyncResult *) result; \ + if (g_simple_async_result_propagate_error (_simple, error)) \ + return NULL; \ + g_return_val_if_fail (g_simple_async_result_is_valid (result, \ + G_OBJECT (source), tag), \ + NULL); \ + return copy_func (g_simple_async_result_get_op_res_gpointer (_simple)); + +#define empathy_implement_finish_return_pointer(source, tag) \ + GSimpleAsyncResult *_simple; \ + _simple = (GSimpleAsyncResult *) result; \ + if (g_simple_async_result_propagate_error (_simple, error)) \ + return NULL; \ + g_return_val_if_fail (g_simple_async_result_is_valid (result, \ + G_OBJECT (source), tag), \ + NULL); \ + return g_simple_async_result_get_op_res_gpointer (_simple); + G_END_DECLS #endif /* __EMPATHY_UTILS_H__ */ |