summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-21 12:23:21 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-26 12:35:22 +0200
commitf34ec7df6a34724ce178ff779d06d024b4fc5e3f (patch)
tree89c5b34cde9ff85c6a0155cba58fda9e93cc2c1b
parent4d403b11727958ced86de4c650467117cbc073b9 (diff)
make _tpl_log_manager_add_message_finish sane
Validate arguments and properly propagate the error. There is no need to use a res boolean to indicate if the operation succeed or not, the error is enough.
-rw-r--r--telepathy-logger/log-manager.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index cb16744db..224b0e109 100644
--- a/telepathy-logger/log-manager.c
+++ b/telepathy-logger/log-manager.c
@@ -782,10 +782,19 @@ _tpl_log_manager_add_message_finish (TplLogManager *self,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ GSimpleAsyncResult *simple;
- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
- return g_simple_async_result_get_op_res_gboolean (simple);
+ g_return_val_if_fail (TPL_IS_LOG_MANAGER (self), FALSE);
+ g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
+ g_return_val_if_fail (g_simple_async_result_is_valid (result,
+ G_OBJECT (self), _tpl_log_manager_add_message_async), FALSE);
+
+ simple = G_SIMPLE_ASYNC_RESULT (result);
+
+ if (g_simple_async_result_propagate_error (simple, error))
+ return FALSE;
+
+ return TRUE;
}
@@ -809,8 +818,6 @@ _add_message_async_thread (GSimpleAsyncResult *simple,
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);
}
- else
- g_simple_async_result_set_op_res_gboolean (simple, TRUE);
}
void