diff -ur empathy-2.31.92/src/empathy-chat-window.c empathy-2.31.92.patched/src/empathy-chat-window.c --- empathy-2.31.92/src/empathy-chat-window.c 2010-09-01 14:01:33.000000000 +0400 +++ empathy-2.31.92.patched/src/empathy-chat-window.c 2010-09-17 16:10:29.000000000 +0400 @@ -2067,9 +2067,8 @@ return EMPATHY_CHAT_WINDOW (g_object_new (EMPATHY_TYPE_CHAT_WINDOW, NULL)); } -/* Returns the window to open a new tab in if there is only one window - * visble, otherwise, returns NULL indicating that a new window should - * be added. +/* Returns the window to open a new tab in if there is a suitable window, + * otherwise, returns NULL indicating that a new window should be added. */ EmpathyChatWindow * empathy_chat_window_get_default (gboolean room) @@ -2097,21 +2096,22 @@ priv = GET_PRIV (chat_window); dialog = empathy_chat_window_get_dialog (chat_window); - if (empathy_window_get_is_visible (GTK_WINDOW (dialog))) { - guint nb_rooms, nb_private; - empathy_chat_window_get_nb_chats (chat_window, &nb_rooms, &nb_private); - - /* Skip the window if there aren't any rooms in it */ - if (room && nb_rooms == 0) - continue; - - /* Skip the window if there aren't any 1-1 chats in it */ - if (!room && nb_private == 0) - continue; - - /* Found a visible window on this desktop */ - return chat_window; - } + + guint nb_rooms, nb_private; + empathy_chat_window_get_nb_chats (chat_window, &nb_rooms, &nb_private); + + /* Skip the window if there aren't any rooms in it */ + if (room && nb_rooms == 0) + continue; + + /* Skip the window if there aren't any 1-1 chats in it */ + if (!room && nb_private == 0) + continue; + + /* Found a window on this desktop, make it visible if necessary */ + if (!empathy_window_get_is_visible (GTK_WINDOW (dialog))) + empathy_window_present (GTK_WINDOW (dialog)); + return chat_window; } return NULL;