]> git.0d.be Git - empathy.git/blobdiff - src/empathy-chat-window.c
Merge remote-tracking branch 'glassrose/add-All-service-selection-in-debug-window'
[empathy.git] / src / empathy-chat-window.c
index 337bae942fe7c61d98333fb5bdaee556c0263434..4e3f0480788547ba258fd5d80a05066cf2bd19e4 100644 (file)
@@ -342,13 +342,25 @@ confirm_close (EmpathyChatWindow *window,
        gtk_window_present (GTK_WINDOW (dialog));
 }
 
+/* Returns TRUE if we should check if the user really wants to leave.  If it's
+ * a multi-user chat, and it has a TpChat (so there's an underlying channel, so
+ * the user is actually in the room as opposed to having been kicked or gone
+ * offline or something), then we should check.
+ */
+static gboolean
+chat_needs_close_confirmation (EmpathyChat *chat)
+{
+       return (empathy_chat_is_room (chat)
+               && empathy_chat_get_tp_chat (chat) != NULL);
+}
+
 static void
 maybe_close_chat (EmpathyChatWindow *window,
                   EmpathyChat *chat)
 {
        g_return_if_fail (chat != NULL);
 
-       if (empathy_chat_is_room (chat)) {
+       if (chat_needs_close_confirmation (chat)) {
                confirm_close (window, FALSE, 1, chat);
        } else {
                empathy_chat_window_remove_chat (window, chat);
@@ -916,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) {
@@ -1421,7 +1442,7 @@ chat_window_delete_event_cb (GtkWidget        *dialog,
        DEBUG ("Delete event received");
 
        for (l = priv->chats; l != NULL; l = l->next) {
-               if (empathy_chat_is_room (l->data)) {
+               if (chat_needs_close_confirmation (l->data)) {
                        chat = l->data;
                        n_rooms++;
                }
@@ -1548,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)
 {
@@ -1658,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);
                }