[empathy: 8/10] utils: add the _finish macros from wocky



commit 267fb729f0536843bcb7c42858bd3d6a6d029411
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Tue Feb 1 08:41:24 2011 +0000

    utils: add the _finish macros from wocky
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 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 3c89962..f0ac666 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__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]