aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r--src/empathy-chat-window.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 937e68aff..47ef37c42 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -175,7 +175,7 @@ chat_tab_style_set_cb (GtkWidget *hbox,
"chat-window-tab-close-button");
context = gtk_widget_get_pango_context (hbox);
- metrics = pango_context_get_metrics (context, hbox->style->font_desc,
+ metrics = pango_context_get_metrics (context, gtk_widget_get_style (hbox)->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
@@ -994,6 +994,24 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
}
static void
+chat_window_set_highlight_room_tab_label (EmpathyChat *chat)
+{
+ gchar *markup;
+ GtkWidget *widget;
+
+ if (empathy_chat_is_room (chat) == FALSE)
+ return;
+
+ markup = g_markup_printf_escaped ("<span color=\"%s\">%s</span>",
+ "red",
+ empathy_chat_get_name (chat));
+
+ widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-label");
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ g_free (markup);
+}
+
+static void
chat_window_new_message_cb (EmpathyChat *chat,
EmpathyMessage *message,
EmpathyChatWindow *window)
@@ -1025,6 +1043,11 @@ chat_window_new_message_cb (EmpathyChat *chat,
return;
}
+ if (!g_list_find (priv->chats_new_msg, chat)) {
+ priv->chats_new_msg = g_list_prepend (priv->chats_new_msg, chat);
+ chat_window_update_chat_tab (chat);
+ }
+
/* If empathy_chat_is_room () returns TRUE, that means it's a named MUC.
* If empathy_chat_get_remote_contact () returns NULL, that means it's
* an unamed MUC (msn-like).
@@ -1038,18 +1061,15 @@ chat_window_new_message_cb (EmpathyChat *chat,
}
if (needs_urgency) {
- if (!has_focus)
+ if (!has_focus) {
chat_window_set_urgency_hint (window, TRUE);
+ chat_window_set_highlight_room_tab_label (chat);
+ }
empathy_sound_play (GTK_WIDGET (priv->dialog),
EMPATHY_SOUND_MESSAGE_INCOMING);
chat_window_show_or_update_notification (window, message, chat);
}
-
- if (!g_list_find (priv->chats_new_msg, chat)) {
- priv->chats_new_msg = g_list_prepend (priv->chats_new_msg, chat);
- chat_window_update_chat_tab (chat);
- }
}
static GtkNotebook *
@@ -1241,7 +1261,7 @@ chat_window_drag_data_received (GtkWidget *widget,
const gchar *account_id;
const gchar *contact_id;
- id = (const gchar*) selection->data;
+ id = (const gchar*) gtk_selection_data_get_data (selection);
account_manager = empathy_account_manager_dup_singleton ();
DEBUG ("DND contact from roster with id:'%s'", id);
@@ -1249,7 +1269,7 @@ chat_window_drag_data_received (GtkWidget *widget,
strv = g_strsplit (id, "/", 2);
account_id = strv[0];
contact_id = strv[1];
- account = empathy_account_manager_lookup (account_manager, account_id);
+ account = empathy_account_manager_get_account (account_manager, account_id);
chat = empathy_chat_window_find_chat (account, contact_id);
if (!chat) {
@@ -1262,11 +1282,9 @@ chat_window_drag_data_received (GtkWidget *widget,
connection, contact_id, NULL, NULL);
}
- g_object_unref (account);
g_strfreev (strv);
return;
}
- g_object_unref (account);
g_object_unref (account_manager);
g_strfreev (strv);
@@ -1298,7 +1316,7 @@ chat_window_drag_data_received (GtkWidget *widget,
DEBUG ("DND tab");
- chat = (void *) selection->data;
+ chat = (void *) gtk_selection_data_get_data (selection);
old_window = chat_window_find_chat (*chat);
if (old_window) {
@@ -1758,7 +1776,7 @@ empathy_chat_window_find_chat (EmpathyAccount *account,
chat = ll->data;
- if (empathy_account_equal (account, empathy_chat_get_account (chat)) &&
+ if (account == empathy_chat_get_account (chat) &&
!tp_strdiff (id, empathy_chat_get_id (chat))) {
return chat;
}