aboutsummaryrefslogtreecommitdiffstats
path: root/tp-account-widgets
diff options
context:
space:
mode:
authorMarco Barisione <marco.barisione@collabora.co.uk>2013-05-10 00:10:17 +0800
committerMarco Barisione <marco.barisione@collabora.co.uk>2013-08-20 18:03:06 +0800
commit431c21692c396b39764eca31c3c4f05f4507ce59 (patch)
treea9f8fc0fa9ca7ee6255df908f9f1ef2059ac5875 /tp-account-widgets
parentfad2ecd3f071c671425954638081c641ff603503 (diff)
downloadgsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar.gz
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar.bz2
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar.lz
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar.xz
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.tar.zst
gsoc2013-empathy-431c21692c396b39764eca31c3c4f05f4507ce59.zip
tpaw-utils: move empathy_implement_finish_* to tp-aw and rename them
All the code was initially written for wocky which is under LGPL. https://bugzilla.gnome.org/show_bug.cgi?id=699492
Diffstat (limited to 'tp-account-widgets')
-rw-r--r--tp-account-widgets/tpaw-avatar-chooser.c3
-rw-r--r--tp-account-widgets/tpaw-keyring.c11
-rw-r--r--tp-account-widgets/tpaw-user-info.c3
-rw-r--r--tp-account-widgets/tpaw-utils.h45
4 files changed, 55 insertions, 7 deletions
diff --git a/tp-account-widgets/tpaw-avatar-chooser.c b/tp-account-widgets/tpaw-avatar-chooser.c
index 7d28c4217..6813cb673 100644
--- a/tp-account-widgets/tpaw-avatar-chooser.c
+++ b/tp-account-widgets/tpaw-avatar-chooser.c
@@ -27,6 +27,7 @@
#include <tp-account-widgets/tpaw-camera-monitor.h>
#include <tp-account-widgets/tpaw-gsettings.h>
#include <tp-account-widgets/tpaw-images.h>
+#include <tp-account-widgets/tpaw-utils.h>
#ifdef HAVE_CHEESE
#include <cheese-avatar-chooser.h>
@@ -1218,5 +1219,5 @@ tpaw_avatar_chooser_apply_finish (TpawAvatarChooser *self,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_void (self, tpaw_avatar_chooser_apply_async);
+ tpaw_implement_finish_void (self, tpaw_avatar_chooser_apply_async);
}
diff --git a/tp-account-widgets/tpaw-keyring.c b/tp-account-widgets/tpaw-keyring.c
index 94bbd93e0..0de6f8b5d 100644
--- a/tp-account-widgets/tpaw-keyring.c
+++ b/tp-account-widgets/tpaw-keyring.c
@@ -33,6 +33,7 @@
#endif
#include "empathy-utils.h"
+#include "tpaw-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
@@ -324,7 +325,7 @@ tpaw_keyring_get_account_password_finish (TpAccount *account,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_return_pointer (account,
+ tpaw_implement_finish_return_pointer (account,
tpaw_keyring_get_account_password_async);
}
@@ -333,7 +334,7 @@ tpaw_keyring_get_room_password_finish (TpAccount *account,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_return_pointer (account,
+ tpaw_implement_finish_return_pointer (account,
tpaw_keyring_get_room_password_async);
}
@@ -637,7 +638,7 @@ tpaw_keyring_set_account_password_finish (TpAccount *account,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_void (account, tpaw_keyring_set_account_password_async);
+ tpaw_implement_finish_void (account, tpaw_keyring_set_account_password_async);
}
gboolean
@@ -645,7 +646,7 @@ tpaw_keyring_set_room_password_finish (TpAccount *account,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_void (account, tpaw_keyring_set_room_password_async);
+ tpaw_implement_finish_void (account, tpaw_keyring_set_room_password_async);
}
/* delete */
@@ -716,5 +717,5 @@ tpaw_keyring_delete_account_password_finish (TpAccount *account,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_void (account, tpaw_keyring_delete_account_password_async);
+ tpaw_implement_finish_void (account, tpaw_keyring_delete_account_password_async);
}
diff --git a/tp-account-widgets/tpaw-user-info.c b/tp-account-widgets/tpaw-user-info.c
index 9a4843fe9..5dddd88a0 100644
--- a/tp-account-widgets/tpaw-user-info.c
+++ b/tp-account-widgets/tpaw-user-info.c
@@ -25,6 +25,7 @@
#include <tp-account-widgets/tpaw-calendar-button.h>
#include <tp-account-widgets/tpaw-contactinfo-utils.h>
#include <tp-account-widgets/tpaw-time.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-utils.h"
@@ -772,5 +773,5 @@ tpaw_user_info_apply_finish (TpawUserInfo *self,
GAsyncResult *result,
GError **error)
{
- empathy_implement_finish_void (self, tpaw_user_info_apply_async);
+ tpaw_implement_finish_void (self, tpaw_user_info_apply_async);
}
diff --git a/tp-account-widgets/tpaw-utils.h b/tp-account-widgets/tpaw-utils.h
index d38a7a7b5..c648ae804 100644
--- a/tp-account-widgets/tpaw-utils.h
+++ b/tp-account-widgets/tpaw-utils.h
@@ -38,6 +38,51 @@ const gchar *tpaw_service_name_to_display_name (const gchar *proto_name);
void tpaw_make_color_whiter (GdkRGBA *color);
+/* Copied from wocky/wocky-utils.h */
+
+#define tpaw_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 tpaw_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 tpaw_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 tpaw_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 /* __TPAW_UTILS_H__ */