aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat-window.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-02-11 01:47:47 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2012-02-11 01:52:53 +0800
commita8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c (patch)
tree0adb4a91ae70e1bda8b4315fc0352793e740dd21 /src/empathy-chat-window.c
parentc9c63f5412fbf6f7927c857c7f8f04082abbccde (diff)
downloadgsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar.gz
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar.bz2
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar.lz
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar.xz
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.tar.zst
gsoc2013-empathy-a8e8bd5d88bdb4a02bd40ab559bcd62612b63f9c.zip
Don't unhighlight chat tabs when more messages are received
Travis noticed that if you receive a message in which you are not mentioned after one in which you are, the highlight on the chat tab is cleared. This turned out to be because the text of the chat tab label was set in two different places in empathy-chat-window.c: one which takes should_highlight into account, and one which does not. This patch makes EmpathyChat keep track of whether it should be highlighted (reusing empathy_chat_messages_read(), which is called to acknowledge messages as having been seen by the user, to clear the flag), and then uses that from one of the label-updating code paths and deletes the other. https://bugzilla.gnome.org/show_bug.cgi?id=669823
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r--src/empathy-chat-window.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 634968593..4e3f04807 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -928,10 +928,19 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
g_free (markup);
/* Update tab and menu label */
+ if (empathy_chat_is_highlighted (chat)) {
+ markup = g_markup_printf_escaped (
+ "<span color=\"red\" weight=\"bold\">%s</span>",
+ name);
+ } else {
+ markup = g_markup_escape_text (name, -1);
+ }
+
widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-label");
- gtk_label_set_text (GTK_LABEL (widget), name);
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
widget = g_object_get_data (G_OBJECT (chat), "chat-window-menu-label");
- gtk_label_set_text (GTK_LABEL (widget), name);
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ g_free (markup);
/* Update the window if it's the current chat */
if (priv->current_chat == chat) {
@@ -1560,30 +1569,6 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
g_free (escaped);
}
-static void
-chat_window_set_highlight_room_labels (EmpathyChat *chat)
-{
- gchar *markup, *name;
- GtkWidget *widget;
-
- if (!empathy_chat_is_room (chat))
- return;
-
- name = empathy_chat_dup_name (chat);
- markup = g_markup_printf_escaped (
- "<span color=\"red\" weight=\"bold\">%s</span>",
- name);
-
- widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-label");
- gtk_label_set_markup (GTK_LABEL (widget), markup);
-
- widget = g_object_get_data (G_OBJECT (chat), "chat-window-menu-label");
- gtk_label_set_markup (GTK_LABEL (widget), markup);
-
- g_free (name);
- g_free (markup);
-}
-
static gboolean
empathy_chat_window_has_focus (EmpathyChatWindow *window)
{
@@ -1670,8 +1655,6 @@ chat_window_new_message_cb (EmpathyChat *chat,
}
if (needs_urgency) {
- chat_window_set_highlight_room_labels (chat);
-
if (!has_focus) {
chat_window_set_urgency_hint (window, TRUE);
}