From 4cdb4a49b73c5f4698e91029d555a21f4b4e55b3 Mon Sep 17 00:00:00 2001
From: Will Thompson <will.thompson@collabora.co.uk>
Date: Fri, 14 Aug 2009 01:27:19 +0100
Subject: Special-case closing a window with exactly one tab

The confirmation message when closing a window containing one tab, which
is a chat room, should be identical to the confirmation message when
closing that tab with ^W.

https://bugzilla.gnome.org/show_bug.cgi?id=591756
---
 src/empathy-chat-window.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index e22cc8674..1832dcf96 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -268,6 +268,19 @@ confirm_close (EmpathyChatWindow *window,
 
 	priv = GET_PRIV (window);
 
+	/* If there are no chats in this window, how could we possibly have got
+	 * here?
+	 */
+	g_return_if_fail (priv->chats != NULL);
+
+	/* Treat closing a window which only has one tab exactly like closing
+	 * that tab.
+	 */
+	if (close_window && priv->chats->next == NULL) {
+		close_window = FALSE;
+		chat = priv->chats->data;
+	}
+
 	if (close_window) {
 		primary = g_strdup (_("Close this window?"));
 
-- 
cgit v1.2.3