diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-02-08 17:17:55 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-02-08 17:17:55 +0000 |
commit | 7e83bcfc78f002a10f47963172f502035bf8e807 (patch) | |
tree | 0a234afae211ff2901fc2a075ff93fc05f149f81 /telepathy-logger/util.c | |
parent | ce4bcf346f52c6fd9ad41108317a3207f1ed370c (diff) | |
download | telepathy-logger-7e83bcfc78f002a10f47963172f502035bf8e807.tar.gz |
TplChannelText actionchain order fixed
* it's a recommit or 5084ee671ed91648423651260c5d929597861cb3, which for some reason wasn't right.
* added _prepend method to ActionChain
* fixed a action insertion order in TplChannelText, so that TpContacts are
retrieved BEFORE the message pending retrieval
* improved TplChannelText debugging
Diffstat (limited to 'telepathy-logger/util.c')
-rw-r--r-- | telepathy-logger/util.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/telepathy-logger/util.c b/telepathy-logger/util.c index 8290b52..2356dda 100644 --- a/telepathy-logger/util.c +++ b/telepathy-logger/util.c @@ -27,26 +27,26 @@ void tpl_object_unref_if_not_null (gpointer data) { if (data && G_IS_OBJECT (data)) - { - g_object_unref (data); - } + g_object_unref (data); } + void tpl_object_ref_if_not_null (gpointer data) { if (data && G_IS_OBJECT (data)) - { - g_object_ref (data); - } + g_object_ref (data); } + gboolean -tpl_strequal (const gchar *left, const gchar *right) +tpl_strequal (const gchar *left, + const gchar *right) { return ! tp_strdiff(left, right); } + TplActionChain * tpl_actionchain_new (GObject *obj, GAsyncReadyCallback cb, @@ -62,21 +62,29 @@ tpl_actionchain_new (GObject *obj, } +void +tpl_actionchain_free (TplActionChain *self) +{ + g_queue_free (self->chain); + /* TODO free self->simple, I canont understand how */ + g_slice_free (TplActionChain, self); +} + + gpointer tpl_actionchain_get_object (TplActionChain *self) { - g_return_val_if_fail ( self != NULL && self->simple != NULL, NULL); + g_return_val_if_fail (self != NULL && self->simple != NULL, NULL); return g_async_result_get_source_object (G_ASYNC_RESULT (self->simple)); } void -tpl_actionchain_free (TplActionChain *self) +tpl_actionchain_prepend (TplActionChain *self, + TplPendingAction func) { - g_queue_free (self->chain); - /* TODO free self->simple, I canont understand how */ - g_free (self); + g_queue_push_head (self->chain, func); } @@ -93,7 +101,10 @@ tpl_actionchain_continue (TplActionChain *self) { if (g_queue_is_empty (self->chain)) { - g_simple_async_result_complete (self->simple); + GSimpleAsyncResult *simple = self->simple; + tpl_actionchain_free (self); + g_simple_async_result_set_op_res_gboolean ((GSimpleAsyncResult*) simple, TRUE); + g_simple_async_result_complete (simple); } else { @@ -103,9 +114,18 @@ tpl_actionchain_continue (TplActionChain *self) } +void +tpl_actionchain_terminate (TplActionChain *self) +{ + GSimpleAsyncResult *simple = self->simple; + + tpl_actionchain_free (self); + g_simple_async_result_set_op_res_gboolean ((GSimpleAsyncResult*) simple, FALSE); + g_simple_async_result_complete (simple); +} + gboolean tpl_actionchain_finish (GAsyncResult *result) { - /* TODO returnm the real result */ - return TRUE; + return g_simple_async_result_get_op_res_gboolean ((GSimpleAsyncResult*) result); } |