aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-19 20:15:21 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-25 15:22:42 +0800
commit5195f67f8a9fce3da49f875868e288df16df6a52 (patch)
treee4ca1d39ec0c8dd6e27d2d7b59be06dc2a7f2f83 /libempathy-gtk/empathy-chat.c
parent515c3eac45ed42be34feac88245a8a509825bf82 (diff)
downloadgsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar.gz
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar.bz2
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar.lz
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar.xz
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.tar.zst
gsoc2013-empathy-5195f67f8a9fce3da49f875868e288df16df6a52.zip
use tp_text_channel_set_chat_state_async() directly
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 1dbaf5d8a..3fdb3bd53 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -326,6 +326,34 @@ chat_composing_remove_timeout (EmpathyChat *chat)
}
}
+static void
+set_chate_state_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!tp_text_channel_set_chat_state_finish (TP_TEXT_CHANNEL (source), result,
+ &error)) {
+ DEBUG ("Failed to set chat state: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+set_chat_state (EmpathyChat *self,
+ TpChannelChatState state)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ if (!tp_proxy_has_interface_by_id (priv->tp_chat,
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_CHAT_STATE))
+ return;
+
+ tp_text_channel_set_chat_state_async (TP_TEXT_CHANNEL (priv->tp_chat), state,
+ set_chate_state_cb, self);
+}
+
static gboolean
chat_composing_stop_timeout_cb (EmpathyChat *chat)
{
@@ -334,8 +362,7 @@ chat_composing_stop_timeout_cb (EmpathyChat *chat)
priv = GET_PRIV (chat);
priv->composing_stop_timeout_id = 0;
- empathy_tp_chat_set_state (priv->tp_chat,
- TP_CHANNEL_CHAT_STATE_PAUSED);
+ set_chat_state (chat, TP_CHANNEL_CHAT_STATE_PAUSED);
return FALSE;
}
@@ -351,8 +378,7 @@ chat_composing_start (EmpathyChat *chat)
/* Just restart the timeout */
chat_composing_remove_timeout (chat);
} else {
- empathy_tp_chat_set_state (priv->tp_chat,
- TP_CHANNEL_CHAT_STATE_COMPOSING);
+ set_chat_state (chat, TP_CHANNEL_CHAT_STATE_COMPOSING);
}
priv->composing_stop_timeout_id = g_timeout_add_seconds (
@@ -369,8 +395,7 @@ chat_composing_stop (EmpathyChat *chat)
priv = GET_PRIV (chat);
chat_composing_remove_timeout (chat);
- empathy_tp_chat_set_state (priv->tp_chat,
- TP_CHANNEL_CHAT_STATE_ACTIVE);
+ set_chat_state (chat, TP_CHANNEL_CHAT_STATE_ACTIVE);
}
static gint