aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-05-03 20:23:25 +0800
committerXavier Claessens <xclaesse@gmail.com>2011-05-03 20:45:44 +0800
commitaf9137e60f178bcc5fe039c64ea5e7a762ffcc62 (patch)
tree9f2ff10bd51bb459173febb72f67de64903d4300 /libempathy-gtk
parent9c9775421d361b2f615bb06a7e9286bfeb912da0 (diff)
downloadgsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar.gz
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar.bz2
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar.lz
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar.xz
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.tar.zst
gsoc2013-empathy-af9137e60f178bcc5fe039c64ea5e7a762ffcc62.zip
Adium: Also queue events when loading the page
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 8d5b3b7c7..14c544709 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -59,7 +59,8 @@ typedef struct {
gint64 last_timestamp;
gboolean last_is_backlog;
guint pages_loading;
- GList *message_queue;
+ /* Queue of GValue* containing an EmpathyMessage or string */
+ GQueue message_queue;
GtkWidget *inspector_window;
GSettings *gsettings_chat;
gboolean has_focus;
@@ -636,8 +637,9 @@ theme_adium_append_message (EmpathyChatView *view,
gboolean consecutive;
if (priv->pages_loading != 0) {
- priv->message_queue = g_list_prepend (priv->message_queue,
- g_object_ref (msg));
+ GValue *value = tp_g_value_slice_new (EMPATHY_TYPE_MESSAGE);
+ g_value_set_object (value, msg);
+ g_queue_push_tail (&priv->message_queue, value);
return;
}
@@ -837,8 +839,8 @@ theme_adium_append_event (EmpathyChatView *view,
gchar *str_escaped;
if (priv->pages_loading != 0) {
- /* FIXME: events should be queued until page loaded */
- DEBUG ("Error appending event (%s): Page not loaded", str);
+ g_queue_push_tail (&priv->message_queue,
+ tp_g_value_slice_new_string (str));
return;
}
@@ -1090,6 +1092,7 @@ theme_adium_load_finished_cb (WebKitWebView *view,
{
EmpathyThemeAdiumPriv *priv = GET_PRIV (view);
EmpathyChatView *chat_view = EMPATHY_CHAT_VIEW (view);
+ GList *l;
DEBUG ("Page loaded");
priv->pages_loading--;
@@ -1098,14 +1101,20 @@ theme_adium_load_finished_cb (WebKitWebView *view,
return;
/* Display queued messages */
- priv->message_queue = g_list_reverse (priv->message_queue);
- while (priv->message_queue) {
- EmpathyMessage *message = priv->message_queue->data;
+ for (l = priv->message_queue.head; l != NULL; l = l->next) {
+ GValue *value = l->data;
- theme_adium_append_message (chat_view, message);
- priv->message_queue = g_list_remove (priv->message_queue, message);
- g_object_unref (message);
+ if (G_VALUE_HOLDS_OBJECT (value)) {
+ theme_adium_append_message (chat_view,
+ g_value_get_object (value));
+ } else {
+ theme_adium_append_event (chat_view,
+ g_value_get_string (value));
+ }
+
+ tp_g_value_slice_free (value);
}
+ g_queue_clear (&priv->message_queue);
}
static void
@@ -1381,6 +1390,7 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme)
theme->priv = priv;
+ g_queue_init (&priv->message_queue);
priv->allow_scrolling = TRUE;
priv->smiley_manager = empathy_smiley_manager_dup_singleton ();