diff options
author | Will Thompson <will@willthompson.co.uk> | 2012-01-18 23:54:48 +0800 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2012-01-19 01:47:25 +0800 |
commit | 3030fa4e082c695fa25b564e513307f3423feaae (patch) | |
tree | 3d2795a6a2662a708cfad2a83165000e78640b76 /libempathy-gtk/empathy-theme-adium.c | |
parent | aded85c91fb409bafb06492ddb85aa1224178d4c (diff) | |
download | gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar.gz gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar.bz2 gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar.lz gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar.xz gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.tar.zst gsoc2013-empathy-3030fa4e082c695fa25b564e513307f3423feaae.zip |
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.
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 19 |
1 files changed, 12 insertions, 7 deletions
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: |