diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-08 00:52:26 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-08 00:59:34 +0800 |
commit | 23414db5acced9ab25ca012e86b4efbd1653bbcc (patch) | |
tree | 385b3545a2cf77d4981bfb2329df9ec0cbf19669 /src | |
parent | 208e7858319b6b10c592b615fd5ef1559cf44b5b (diff) | |
download | gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar.gz gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar.bz2 gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar.lz gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar.xz gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.tar.zst gsoc2013-empathy-23414db5acced9ab25ca012e86b4efbd1653bbcc.zip |
change empathy_chat_window_get_nb_rooms to get_chats_type
That way we can implement the semantic we meant to. Muc and 1-1 chat are
handled the same way.
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-chat-window.c | 23 | ||||
-rw-r--r-- | src/empathy-chat-window.h | 4 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 903f18fbf..3f12b6393 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1852,7 +1852,6 @@ empathy_chat_window_get_default (gboolean room) { GList *l; gboolean separate_windows = TRUE; - guint nb_rooms; empathy_conf_get_bool (empathy_conf_get (), EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, @@ -1873,14 +1872,15 @@ empathy_chat_window_get_default (gboolean room) dialog = empathy_chat_window_get_dialog (chat_window); if (empathy_window_get_is_visible (GTK_WINDOW (dialog))) { - nb_rooms = empathy_chat_window_get_nb_rooms (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_rooms > 0) + if (!room && nb_private == 0) continue; /* Found a visible window on this desktop */ @@ -2114,17 +2114,24 @@ empathy_chat_window_present_chat (EmpathyChat *chat) gtk_widget_grab_focus (chat->input_text_view); } -guint -empathy_chat_window_get_nb_rooms (EmpathyChatWindow *self) +void +empathy_chat_window_get_nb_chats (EmpathyChatWindow *self, + guint *nb_rooms, + guint *nb_private) { EmpathyChatWindowPriv *priv = GET_PRIV (self); GList *l; - guint nb = 0; + guint _nb_rooms = 0, _nb_private = 0; for (l = priv->chats; l != NULL; l = g_list_next (l)) { if (empathy_chat_is_room (EMPATHY_CHAT (l->data))) - nb++; + _nb_rooms++; + else + _nb_private++; } - return nb; + if (nb_rooms != NULL) + *nb_rooms = _nb_rooms; + if (nb_private != NULL) + *nb_private = _nb_private; } diff --git a/src/empathy-chat-window.h b/src/empathy-chat-window.h index a347352a9..93ffcc53a 100644 --- a/src/empathy-chat-window.h +++ b/src/empathy-chat-window.h @@ -74,7 +74,9 @@ EmpathyChat * empathy_chat_window_find_chat (TpAccount *account const gchar *id); void empathy_chat_window_present_chat (EmpathyChat *chat); -guint empathy_chat_window_get_nb_rooms (EmpathyChatWindow *window); +void empathy_chat_window_get_nb_chats (EmpathyChatWindow *window, + guint *nb_rooms, + guint *nb_private); G_END_DECLS |