From 3030fa4e082c695fa25b564e513307f3423feaae Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 18 Jan 2012 15:54:48 +0000 Subject: chat_view_append_message: take a should_highlight argument Rather than the EmpathyChatView implementations calling empathy_message_should_highlight() themselves, this patch makes EmpathyChat take responsibility for doing so. The theme preview in Preferences, whether deliberately or otherwise, highlights the line in which Juliet mentions Romeo. This behaviour is preserved. --- libempathy-gtk/empathy-theme-adium.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'libempathy-gtk/empathy-theme-adium.c') diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 7b0cd2169..98df46b79 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -132,13 +132,15 @@ typedef struct { guint type; EmpathyMessage *msg; char *str; + gboolean should_highlight; } QueuedItem; static QueuedItem * queue_item (GQueue *queue, guint type, EmpathyMessage *msg, - const char *str) + const char *str, + gboolean should_highlight) { QueuedItem *item = g_slice_new0 (QueuedItem); @@ -146,6 +148,7 @@ queue_item (GQueue *queue, if (msg != NULL) item->msg = g_object_ref (msg); item->str = g_strdup (str); + item->should_highlight = should_highlight; g_queue_push_tail (queue, item); @@ -775,7 +778,8 @@ theme_adium_remove_all_focus_marks (EmpathyThemeAdium *theme) static void theme_adium_append_message (EmpathyChatView *view, - EmpathyMessage *msg) + EmpathyMessage *msg, + gboolean should_highlight) { EmpathyThemeAdium *theme = EMPATHY_THEME_ADIUM (view); EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); @@ -797,7 +801,7 @@ theme_adium_append_message (EmpathyChatView *view, gboolean action; if (priv->pages_loading != 0) { - queue_item (&priv->message_queue, QUEUED_MESSAGE, msg, NULL); + queue_item (&priv->message_queue, QUEUED_MESSAGE, msg, NULL, should_highlight); return; } @@ -886,7 +890,7 @@ theme_adium_append_message (EmpathyChatView *view, } else { g_string_append (message_classes, " incoming"); } - if (empathy_message_should_highlight (msg)) { + if (should_highlight) { g_string_append (message_classes, " mention"); } if (empathy_message_get_tptype (msg) == TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY) { @@ -975,7 +979,7 @@ theme_adium_append_event (EmpathyChatView *view, gchar *str_escaped; if (priv->pages_loading != 0) { - queue_item (&priv->message_queue, QUEUED_EVENT, NULL, str); + queue_item (&priv->message_queue, QUEUED_EVENT, NULL, str, FALSE); return; } @@ -1005,7 +1009,7 @@ theme_adium_edit_message (EmpathyChatView *view, GError *error = NULL; if (priv->pages_loading != 0) { - queue_item (&priv->message_queue, QUEUED_EDIT, message, NULL); + queue_item (&priv->message_queue, QUEUED_EDIT, message, NULL, FALSE); return; } @@ -1345,7 +1349,8 @@ theme_adium_load_finished_cb (WebKitWebView *view, switch (item->type) { case QUEUED_MESSAGE: - theme_adium_append_message (chat_view, item->msg); + theme_adium_append_message (chat_view, item->msg, + item->should_highlight); break; case QUEUED_EDIT: -- cgit v1.2.3