diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-07 23:15:03 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-08 00:59:34 +0800 |
commit | 784b5bd127a9cb1bb725f6c3e1e5338015383037 (patch) | |
tree | ead3290eb0ca6905dc195a2d71ce5fa02f18d38c | |
parent | bc50bd062a3a9bb85e6c3e0228571c670532fdf9 (diff) | |
download | gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar.gz gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar.bz2 gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar.lz gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar.xz gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.tar.zst gsoc2013-empathy-784b5bd127a9cb1bb725f6c3e1e5338015383037.zip |
empathy_chat_window_get_default: check if the window has at least one room
Also, check if the window has a least one 1-1 chat before adding a new one.
That way we won't mix 1-1 and muc chat if user doesn't want to (he can still
re-arrange the tabs manually).
-rw-r--r-- | src/empathy-chat-window.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index c2e32bc17..7d2401677 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1852,6 +1852,7 @@ empathy_chat_window_get_default (gboolean room_filter) { GList *l; gboolean separate_windows = TRUE; + guint nb_rooms; empathy_conf_get_bool (empathy_conf_get (), EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, @@ -1871,8 +1872,17 @@ empathy_chat_window_get_default (gboolean room_filter) priv = GET_PRIV (chat_window); dialog = empathy_chat_window_get_dialog (chat_window); - if (empathy_window_get_is_visible (GTK_WINDOW (dialog)) && - empathy_chat_is_room (priv->current_chat) == room_filter) { + if (empathy_window_get_is_visible (GTK_WINDOW (dialog))) { + nb_rooms = empathy_chat_window_get_nb_rooms (chat_window); + + /* We add a new room only if the window has at least one room */ + if (room_filter && nb_rooms == 0) + continue; + + /* We add a new 1-1 chat only if the window has at least one 1-1 chat */ + if (!room_filter && nb_rooms > 0) + continue; + /* Found a visible window on this desktop */ return chat_window; } |