empathy r643 - trunk/libempathy-gtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r643 - trunk/libempathy-gtk
- Date: Sat, 16 Feb 2008 10:21:01 +0000 (GMT)
Author: xclaesse
Date: Sat Feb 16 10:21:01 2008
New Revision: 643
URL: http://svn.gnome.org/viewvc/empathy?rev=643&view=rev
Log:
Wait a bit before displaying pending messages of a chat to have a chance to get alias/avatar.
Modified:
trunk/libempathy-gtk/empathy-chat.c
Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c (original)
+++ trunk/libempathy-gtk/empathy-chat.c Sat Feb 16 10:21:01 2008
@@ -81,6 +81,7 @@
time_t last_log_timestamp;
gboolean is_first_char;
guint block_events_timeout_id;
+ GList *pending_messages;
/* Used to automatically shrink a window that has temporarily
* grown due to long input.
*/
@@ -397,6 +398,9 @@
chat_composing_remove_timeout (chat);
g_object_unref (priv->log_manager);
+ g_list_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->pending_messages);
+
dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged",
G_CALLBACK (chat_status_changed_cb),
chat);
@@ -441,6 +445,13 @@
empathy_chat_view_append_event (chat->view, _("Disconnected"));
gtk_widget_set_sensitive (chat->input_text_view, FALSE);
+ if (priv->block_events_timeout_id != 0) {
+ g_source_remove (priv->block_events_timeout_id);
+ }
+
+ g_list_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->pending_messages);
+
if (EMPATHY_CHAT_GET_CLASS (chat)->set_tp_chat) {
EMPATHY_CHAT_GET_CLASS (chat)->set_tp_chat (chat, NULL);
}
@@ -524,6 +535,14 @@
return;
}
+ if (chat->block_events) {
+ /* Wait until block_events cb before displaying
+ * them to have to chance to get alias/avatar of sender. */
+ priv->pending_messages = g_list_append (priv->pending_messages,
+ g_object_ref (message));
+ return;
+ }
+
sender = empathy_message_get_sender (message);
empathy_debug (DEBUG_DOMAIN, "Appending message ('%s')",
empathy_contact_get_name (sender));
@@ -1449,10 +1468,18 @@
{
EmpathyChat *chat = EMPATHY_CHAT (data);
EmpathyChatPriv *priv = GET_PRIV (chat);
+ GList *l;
chat->block_events = FALSE;
priv->block_events_timeout_id = 0;
+ for (l = priv->pending_messages; l; l = l->next) {
+ chat_message_received_cb (priv->tp_chat, l->data, chat);
+ g_object_unref (l->data);
+ }
+ g_list_free (priv->pending_messages);
+ priv->pending_messages = NULL;
+
return FALSE;
}
@@ -1461,7 +1488,7 @@
EmpathyTpChat *tp_chat)
{
EmpathyChatPriv *priv;
- GList *messages, *l;
+ GList *messages;
g_return_if_fail (EMPATHY_IS_CHAT (chat));
g_return_if_fail (EMPATHY_IS_TP_CHAT (tp_chat));
@@ -1520,14 +1547,11 @@
G_CALLBACK (chat_destroy_cb),
chat);
- /* Get pending messages */
+ /* Get pending messages, wait until block_events cb before displaying
+ * them to have to chance to get alias/avatar of sender. */
empathy_tp_chat_set_acknowledge (tp_chat, TRUE);
messages = empathy_tp_chat_get_pendings (tp_chat);
- for (l = messages; l; l = l->next) {
- chat_message_received_cb (tp_chat, l->data, chat);
- g_object_unref (l->data);
- }
- g_list_free (messages);
+ priv->pending_messages = g_list_concat (priv->pending_messages, messages);
if (!priv->sensitive) {
gtk_widget_set_sensitive (chat->input_text_view, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]